[R] Operating on windows of data

Marc Schwartz MSchwartz at MedAnalytics.com
Sat Mar 20 21:38:06 CET 2004


On Sat, 2004-03-20 at 14:16, Sean Davis wrote:
> I have a data set that is comprised of, for simplicity, a vector of
> numbers that I want to march across in overlapping windows of say 10
> values each, computing a couple of values for each window.  Is there a
> vectorized way to do this, or do I truly need to resort to looping--I
> think so?  Any other clever thoughts?
> 
> Thanks,
> Sean


See the running() function in the 'gregmisc' package on CRAN or the
filter() function in package 'ts', which is part of the standard R
installation.

HTH,

Marc Schwartz




More information about the R-help mailing list