[R] running mean in blocks

peter dalgaard pdalgd at gmail.com
Mon Jul 11 16:14:38 CEST 2011


On Jul 11, 2011, at 11:23 , M. B wrote:

> Hello,
> I am running R on Linux and have a column of data 10000 points long. I would
> like to take a moving average of say 100 points at a time, so I end up with
> one column of 100 points. What is the simplest way of doing this?  I would
> like to be able to adjust the width of the averaging blocks.
> 

aggregate() to do the averaging, gl() to set up the blocking factor.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list