Re: [R] Parameterising apply To Compute Rolling Average of Columns in a matrix

2010-11-27 Thread Gabor Grothendieck
On Wed, Nov 17, 2010 at 2:27 PM, Paolo Rossi wrote: > I sent a post to find a clever way to compute a Rolling Average of columns > in a matrix  and I was given the solution below which I am very pleased > with. > There is a zoo function that does this. The following converts a to zoo, performs t

Re: [R] Parameterising apply To Compute Rolling Average of Columns in a matrix

2010-11-27 Thread Paolo Rossi
Awesome - thanks! Paolo On 17 November 2010 19:44, Ray Brownrigg wrote: > On Thu, 18 Nov 2010, Paolo Rossi wrote: > > I sent a post to find a clever way to compute a Rolling Average of > columns > > in a matrix and I was given the solution below which I am very pleased > > with. > > > > > > R

Re: [R] Parameterising apply To Compute Rolling Average of Columns in a matrix

2010-11-17 Thread Ray Brownrigg
On Thu, 18 Nov 2010, Paolo Rossi wrote: > I sent a post to find a clever way to compute a Rolling Average of columns > in a matrix and I was given the solution below which I am very pleased > with. > > > RollingAverage <- function(x, RollingObs) { > cx <- cumsum(x); > N <- length(x); > Temp <-

Re: [R] Parameterising apply To Compute Rolling Average of Columns in a matrix

2010-11-17 Thread Henrique Dallazuanna
You've tried? apply(a, 2, RollingAverage, 7) On Wed, Nov 17, 2010 at 5:27 PM, Paolo Rossi < statmailingli...@googlemail.com> wrote: > I sent a post to find a clever way to compute a Rolling Average of columns > in a matrix and I was given the solution below which I am very pleased > with. > > >