[R] R equivalent of Splus peaks() function?

Petr Pikal petr.pikal at precheza.cz
Thu Jan 15 09:36:13 CET 2004


Hi

#---------------------------------------------------------------------------------
# funkce pro automaticke oznaceni piku ve spektru (peaks)
# autor Brian Ripley

# span has to be odd number

peaks<-function(series,span=3)
{
z <- embed(series, span)
s <- span%/%2
v<- max.col(z) == 1 + s
result <- c(rep(FALSE,s),v)
result <- result[1:(length(result)-s)]
result
}

HTH 
Petr Pikal

On 14 Jan 2004 at 8:25, Mirka Zednikova wrote:

> If there something available in R that has the
> functionality of the S-PLUS peaks() function?
> 
> Thanks,
> 
> Mirka
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list