This function has been deprecated in favor of the identical new function first_maxima
first_peak(
y,
x = NULL,
window_width = NULL,
window_width_n = NULL,
window_height = NULL,
return = "index",
return_endpoints = TRUE,
...
)
If return = "index"
, a vector of indices corresponding
to local extrema in the data
If return = "x"
, a vector of x values corresponding
to local extrema in the data
If return = "y"
, a vector of y values corresponding
to local extrema in the data
Numeric vector of y values in which to identify local extrema
Optional numeric vector of corresponding x values
Width of the window (in units of x
) used to
search for local extrema. A narrower width will be more
sensitive to narrow local maxima/minima, while a wider
width will be less sensitive to local maxima/minima.
The maximum number of data points a single
extrema-search step is allowed to take. For example,
when maxima-finding, the function will not pass
a valley consisting of more than window_width_n
data points.
A smaller window_width_n
will be more sensitive
to narrow local maxima/minima, while a larger
window_width_n
will be less sensitive to
narrow local maxima/minima.
If not provided, defaults to ~0.2*length(y)
The maximum change in y
a single extrema-search
step is allowed to take. For example, when
maxima-finding, the function will not pass a
valley deeper than window_height
.
A smaller window_height
will be more sensitive
to shallow local maxima/minima, while a larger
window_height
will be less sensitive to
shallow maxima/minima.
One of c("index", "x", "y"), determining whether the function will return the index, x value, or y value associated with the first maxima in y values
Should the first or last value in y
be allowed to be returned?
Other parameters to pass to find_local_extrema
This function takes a vector of y
values and returns the index
(by default) of the first local maxima. It serves as a shortcut
for find_local_extrema(return_maxima = TRUE, return_minima = FALSE)[1]
If none of window_width
, window_width_n
, or
window_height
are provided, default value of window_width_n
will be used.
[first_maxima()]