Skip to content

R equivalent of Splus peaks() function?

2 messages · Mirka Zednikova, PIKAL Petr

#
If there something available in R that has the
functionality of the S-PLUS peaks() function?

Thanks,

Mirka
#
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:

            
Petr Pikal
petr.pikal at precheza.cz