Detect the peaks positions and valley positions. The algorithm is modified from github::dgromer/peakdet

peakdet(y, delta = 0, silence = TRUE)

Arguments

y

A vector of numeric where to search peaks

delta

A numeric of length 1, defining the local threshold for peak detection. If it is set to 0, the delta will be set to 1/10 of the range of y.

silence

logical(1). If false, echo the delta value when delta is set as 0.

Value

A list with peakpos and valleypos. Both peakpos and valleypos are vectors of numeric which indicate the positions of peak or valley.