Hi

I have 3500 rows of data (say a single column) in a vector. If I want to
compare every ith element with the simple average of the previous (i-5)
elements, then I could write something like this:

for(i in 6:NROW(data)){
       if(data[i] => mean(data[(i-5):i]) (counter[i]=1)}
}

Is it possible to replicate the above faster in R?


-- 
'Raghu'

	[[alternative HTML version deleted]]

