Learn R Programming

hilbertSimilarity (version 0.4.3)

localMaxima: Find Local Maxima in a vector

Description

Given a density object, find the position of local maxima (inflection points)

Usage

localMaxima(x)

Arguments

x

a vector of density values, as generated through a call to density

Value

a vector of index corresponding to local maxima

Examples

Run this code
# NOT RUN {
x <- c(rnorm(100),rnorm(100,3))
dx <- density(x)
plot(dx)
abline(v=dx$x[localMaxima(dx$y)],col=2,lty=2)
# }

Run the code above in your browser using DataLab