peaks: Identify peaks

Description Usage Arguments Details Value References Examples

Description

Identify local maxima in a numeric vector.

Usage

1
peaks(x, span.abs, threshold = 0)

Arguments

x

a numeric vector

span.abs

NUMERIC the absolute number of points defining the window

threshold

NUMERIC only maxima above this value will be identified as peaks

Details

A local maximum is defined as a value larger than its neighbours in a window defined by span.abs. Peaks are local maxima with values above the given threshold.

Value

a vector of logical values, indicating whether ther is a peak at each point.

References

For this function we re-used code from the former CRAN package ppc http://statweb.stanford.edu/~tibs/PPC/Rdist/index.html

Examples

1
2
3
4
data(profiles)
pks <- peaks(profiles[[1]]$density, span = 60, threshold = .35)
with(profiles[[1]], plot(x, density, type = 'l'))
with(profiles[[1]][pks, ], points(x, density, pch = 19, col = 'red'))

famuvie/peaks documentation built on May 16, 2019, 10:08 a.m.