| localMaxima | R Documentation |
Given a density object, find the position of local maxima (inflection points)
localMaxima(x)
x |
a vector of density values, as generated through a call to |
a vector of index corresponding to local maxima
Tommy https://stackoverflow.com/questions/6836409/finding-local-maxima-and-minima
x <- c(rnorm(100),rnorm(100,3))
dx <- density(x)
plot(dx)
abline(v=dx$x[localMaxima(dx$y)],col=2,lty=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.