require(Hmisc) # Farell's Hmisc library maxima <- function(dh2,limit=0) which( dh2 > limit & dh2 < Lag(dh2,1) & dh2 < Lag(dh2,-1) )