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

From: Martin Maechler <>
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

    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


where in the 2nd hit, 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 mailing list PLEASE do read the posting guide! 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