Hi list,
How do I calculate a moving average without using filter().  filter() does
not seem to give weighted averages.

I am looking into apply(), tapply,... But nothing "moves".

For example,

dat<-c(1:20)
mean(dat[1:3])
mean(dat[4:6])
mean(dat[7:9])
mean(dat[10:12])

etc...

I understand the point of apply is to avoid loops, how should I incorporate
this idea into using an apply()?

Thanks,
Mike

	[[alternative HTML version deleted]]

