localMaxima: Local Maxima

Description Usage Arguments Value Author(s) See Also Examples

View source: R/localMaxima.R

Description

This function finds local maxima in a numeric vector. A local maximum is defined as maximum in a window of the current index +/- hws.

Usage

1
localMaxima(x, hws = 1L)

Arguments

x

numeric, vector that should be searched for local maxima.

hws

integer(1), half window size, the resulting window reaches from (i - hws):(i + hws).

Value

A logical of the same length as x that is TRUE for each local maxima.

Author(s)

Sebastian Gibb

See Also

Other extreme value functions: .peakRegionMask(), refineCentroids(), valleys()

Examples

1
2
3
x <- c(1:5, 4:1, 1:10, 9:1, 1:5, 4:1)
localMaxima(x)
localMaxima(x, hws = 10)

MsCoreUtils documentation built on Nov. 8, 2020, 10:59 p.m.