photobiology (version 0.9.30)

find_peaks: Find peaks in a spectrum

Description

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.

Usage

find_peaks(x, ignore_threshold = 0, span = 3, strict = TRUE, na.rm = FALSE)

Arguments

x

numeric vector

ignore_threshold

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

span

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.

strict

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

na.rm

logical indicating whether NA values should be stripped before searching for peaks.

Value

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

See Also

peaks

Other peaks and valleys functions: get_peaks(), peaks(), valleys(), wls_at_target()

Examples

Run this code
# NOT RUN {
with(sun.data, w.length[find_peaks(s.e.irrad)])

# }

Run the code above in your browser using DataCamp Workspace