calculate peak values in a plot using R -


i have table 2 variables.the data nmr.so when plot spectrum.i found peaks in plot.but need know how list values of peak , store them variable.anyone please help.

an easy implementation based on brian ripley's post @ r-help:

peaks <- function(x, halfwindowsize) {    windowsize <- halfwindowsize * 2 + 1   windows <- embed(x, windowsize)   localmaxima <- max.col(windows, "first") == halfwindowsize + 1    return(c(rep(false, halfwindowsize), localmaxima, rep(false, halfwindowsize))) } 

example:

x <- c(1,3,1,3,1)  peaks(x, 1) ## [1] false  true false  true false 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -