Learn R Programming

simecol (version 0.8-14)

peaks: Find Peaks Within xy-Data

Description

The function returns maxima (values which have only smaller neighbours) and minima (values which have only larger neighbours).

Usage

peaks(x, y=NULL, mode="maxmin")

Arguments

x, y

the coordinates of given points.

mode

specifies if both maxima and minima (mode="maxmin") or only maxima (mode="max") or minima (mode="min") are requested.

Value

A list with x and y coordinates of all peaks.

See Also

approx, upca

Examples

Run this code
# NOT RUN {
x <- sin(seq(0, 10, 0.1))
plot(x)
points(peaks(x), col="red", pch=15)
# }

Run the code above in your browser using DataLab