[R] R equivalent for Splus "peaks"

Mark Myatt mark at myatt.demon.co.uk
Sat Jun 16 12:27:56 CEST 2001


Matthew Wiener <mcw at ln.nimh.nih.gov> writes:

>Does anyone have an equivalent to Splus "peaks", which finds local maxima
>(with locality defined by a parameter "span")?  I thought I'd check
>whether anyone has done it already before trying to put something together
>myself.

Not my solution but one I kept from, I think, Brian Ripley:

        peaks.function(series,span=3)
          {
          z <- embed(series, span)
          result_max.col(z) == 1 + span %/% 2
          result
          }

Mark

--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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