These functions find peaks (local maxima) or valleys (local minima) in a spectrum, using a user selectable size threshold relative to the tallest peak (global maximum). This a wrapper built on top of function peaks from package splus2R.
get_peaks(x, y, ignore_threshold = 0, span = 5, strict = TRUE,
x_unit = "", x_digits = 3)get_valleys(x, y, ignore_threshold = 0, span = 5, strict = TRUE,
x_unit = "", x_digits = 3)
numeric
numeric
numeric Value between 0.0 and 1.0 indicating the relative size compared to tallest peak or deepest valley of the peaks to return.
numeric A peak is defined as an element in a sequence which is
greater than all other elements within a window of width span
centered at that element. For example, a value of 3 means that a peak is
bigger than both of its neighbors.
logical Flag: if TRUE, an element must be strictly greater than all other values in its window to be considered a peak. Default: TRUE.
character Vector of texts to be pasted at end of labels built from x value at peaks.
numeric Number of significant digits in wavelength label.
A data frame with variables w.length and s.irrad with their values at the peaks or valleys plus a character variable of labels.
Other peaks and valleys functions: find_peaks
,
peaks
, valleys
with(sun.spct, get_peaks(w.length, s.e.irrad))
with(sun.spct, get_valleys(w.length, s.e.irrad))
Run the code above in your browser using DataLab