Re: [R] finding peaks in a simple dataset with R

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Thu 24 Nov 2005 - 00:35:14 EST


I've been asked in private,
(and am replying BCC to the asker),

>> I saw your post on the R-help archives page about the possibility of
>> porting a function from S-Plus called peaks() to R. I am looking for

>> some way to locate peaks in a simple x,y data set, and thought that R

>> might be the way to go.

"of course" it is the way to go, don't get lost be going somewhere else :-)
and try

    install.packages("fortune")
    fortune("go with R")

>> Any ideas would be a great help,

Using RSiteSearch("peaks") gives too many hits, among which those you can get by the more advanced (regular expression) call

    RSiteSearch("/peaks\\b.*\\bfunction/")

where in the 2nd hit,

    http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33097.html Petr Pikal gives a simple peaks() function, originally by Brian Ripley which is using embed() and max.col() smartly.

I wonder if we shouldn't polish that a bit and add to R's standard 'utils' package.

Martin Maechler, ETH Zurich



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Nov 24 00:42:51 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:18 EST