[R] sliding window over a large vector

Carl Witthoft carl at witthoft.com
Fri Dec 19 04:37:21 CET 2008

Because I had too much time on my hands, here's a little function that 
will do whatever you want over a window you specify. No, I haven't done 
any time trials :-(

# my  own boxcar tool, just because.
# use bfunc to specify what function to apply to the windowed
# region.
boxcar<-function(x, width=5, bfunc='mean'){
	boxout<-mapply(function(shiftx) {
		} ,seq(1,(length(x)-width))

More information about the R-help mailing list