find_peaks: Find peaks in a spectrum

Description Usage Arguments Value Note See Also Examples


This function finds all peaks (local maxima) 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.


find_peaks(x, ignore_threshold = 0, span = 3, strict = TRUE)



numeric array


numeric value between 0.0 and 1.0 indicating the size threshold below which peaks will be ignored.


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. The default value is 3, meaning that a peak is bigger than both of its neighbors. Default: 3.


ogical flag: if TRUE, an element must be strictly greater than all other values in its window to be considered a peak. Default: TRUE.


an object like s.irrad of logical values. Values that are TRUE correspond to local peaks in the data.


This function is a wrapper built on function peaks from splus2R and handles non-finite (including NA) values differently than peaks, instead of giving an error they are replaced with the smallest finite value in x.

See Also


Other peaks and valleys functions: get_peaks, peaks, valleys


with(, w.length[find_peaks(s.e.irrad)])

Search within the photobiology package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.