Learn R Programming

CHAT (version 1.1)

getPeaks: Find peaks on a curve

Description

Find all the local maxima and their corresponding positions in a given curve.

Usage

getPeaks(x, y, sep = 8, thr = 0.01)

Arguments

x
x coordinates for the curve.
y
y coordinates for the curve.
sep
number of initial split of the curve.
thr
sensitivity threshold to call a local maxima.

Value

numeric matrix with two columns: position of peaks and peak values.

Examples

Run this code
Y=c(rnorm(50,0.4,0.05),rnorm(50,0.8,0.05))
fit=density(Y)
getPeaks(fit$x,fit$y)

Run the code above in your browser using DataLab