findPeak | R Documentation |
Find the position of peak in a vector.
findPeak(x, threshold = 1, length = 4)
x |
A numeric vector. |
threshold |
Integer, only values bigger than |
length |
Integer, minimum |
A numeric vector. The first element is the start index and the second element is the end index of the peak.
If multiple peaks exist, only output the start and end index of the one with maximun length.
If no peak exist, return c(0, 0)
.
# return c(3, 10) findPeak(c(0:5, 5:0), threshold=1, length=4) # Most likely return c(0, 0) findPeak(rnorm(10), threshold=3, length=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.