[R] code for peaks
Matthew Wiener
mcw at ln.nimh.nih.gov
Fri Jun 15 23:06:59 CEST 2001
Hi, all.
Andy Liaw (and one other person, whose name I already lost) pointed out to
me that this was answered on the list a few weeks ago. Petr Pikal posted
code based on an idea from Brian Ripley:
peaks <- function(series, span=3){
z <- embed(series, span)
result <- max.col(z) == 1 + span %/% 2
result
}
Somehow I missed this when searching before I posted.
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list