Skip to content
Prev 42781 / 398506 Next

R equivalent of Splus peaks() function?

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