Skip to content

R equivalent for Splus "peaks"

2 messages · Matthew Wiener, Mark Myatt

#
Hi, all.

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.

Thanks,

Matt Wiener

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Matthew Wiener <mcw at ln.nimh.nih.gov> writes:
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._