Hi: Look into the rollmean() function in package zoo.
HTH, Dennis On Fri, Oct 15, 2010 at 12:34 AM, David A. <dasol...@hotmail.com> wrote: > > Hi list, > > I have a 1710x244 matrix of numerical values and I would like to calculate > the mean of every group of three consecutive values per column to obtain a > new matrix of 570x244. I could get it done using a for loop but how can I > do that using apply functions? > In addition to this, do I have to initizalize a 570x244 matrix with 0's to > store the calculated values or can the output matrix be generated while > calculating the mean values? > > Cheers, > > Dave > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.