[R] Is there a function for finding local extrema.

Philippe Grosjean phgrosje at ulb.ac.be
Fri Jul 26 17:23:23 CEST 2002


To find extrema, you have the turnpoints() function in the optional package
pastecs. Once pastecs is installed on your system, use:

library(pastecs)
example(turnpoints)
?turnpoints

For your particular problem, you can use:
X <- runif(100000)
extract(turnpoints(X), 100000, peak=1, pit=0)

Depending on what you are looking for, you may be interested by additional
statistics about extrema, which is provided by turnogram().
Best regards,

Philippe Grosjean

...........]<(({°<...............<°}))><...............................
( ( ( ( (
 ) ) ) ) )      Philippe Grosjean
( ( ( ( (
 ) ) ) ) )      IFREMER Nantes - DEL/AO
( ( ( ( (       rue de l'Ile d'Yeu, BP 21105, 44311 Nantes Cedex 3
 ) ) ) ) )      tel: (33) 02.40.37.42.29, fax: (33) 02.40.37.42.41
( ( ( ( ( 
 ) ) ) ) )      SciViews project coordinator (http://www.sciviews.org)
( ( ( ( (       e-mail: phgrosjean at sciviews.org
 ) ) ) ) ) 
( ( ( ( (      "I'm 100% confident that p is between 0 and 1"
 ) ) ) ) )                                L. Gonick & W. Smith (1993)
.......................................................................


-----Message d'origine-----
De : owner-r-help at stat.math.ethz.ch
[mailto:owner-r-help at stat.math.ethz.ch]De la part de Witold Eryk Wolski
Envoyé : vendredi 26 juillet 2002 15:46
À : r-help at stat.math.ethz.ch
Objet : [R] Is there a function for finding local extrema.


I have a vector with about 100.000 values representing a quite regular 
function (sinusoid like).
I would like to find all local maxima of this function (should be about 
4000). Is there a native routine for R?
Thanks in advance
Eryk. 


-- 
 _|_  \|/  \|/  Eryk Witold Wolski         tel  :0049-(0)30-8413-1543 w w
 ´v´  'v´ \'v'/ MPI Moleculare Genetik     fax  :0049-(0)30-8413-1139 | |
/| |\/| |\ | |  Mass Spectrometry Group    http://www.molgen.mpg.de  /.^.\ 
 m m  m m  m m  mail :wolski at molen.mpg.de                             /|\


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list