[R] Iterative Averages

Steve Murray smurray444 at hotmail.com
Sat Aug 2 15:28:00 CEST 2008


Dear all,

I have a data frame of 2160 rows and 4320 columns, which I hope to condense to a smaller dataset by finding averages of 6 by 6 blocks of values (to produce a data frame of 360 rows by 720 columns).

How would I go about finding the mean of a 6 x 6 block, then find the mean of the next adjacent 6 x 6 block, and so on, until the whole data frame has been covered?

One slight twist is that I have NA values, which I don't want to be included in the calculations unless a particular 6 x 6 block is entirely composed of NA values - in which case, NA should be the output value.

Thanks very much for any advice and solutions.

Steve

_________________________________________________________________
Get Hotmail on your mobile from Vodafone 



More information about the R-help mailing list