Skip to content
Prev 306376 / 398513 Next

averageif and looping

Hello,

Try the following.


sapply(seq_len(nrow(dat) - 4), function(i){
     w <- window(dat$value, start = i, end = i + 4)
     mean(w[w < 0])})

Hope this helps,

Rui Barradas
Em 26-09-2012 16:38, Eko andryanto Prakasa escreveu: