[R] Calculating variances in a moving window

Philippe Hensel Philippe.Hensel at noaa.gov
Thu Oct 21 23:30:48 CEST 2010


I am trying to create basic descriptive statistics for a spatial dataset 
using moving windows of variable sizes.

I found the filter(dataset, rep(1/a,1)) very useful for obtaining 
averages for a given moving window size "a"
(a is the window size within a column of data in a matrix - the filter 
is applied to all columns automatically)

I could not find anything analogous for calculating variances over a 
moving window.  Is there one available?
Otherwise, I'm slowly cranking away on making my own, but it's quite 
tedious!

Thank you in advance for any insights!

-Philippe



More information about the R-help mailing list