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'){
        
        bfunc<-get(bfunc)
        
        boxout<-mapply(function(shiftx) {
                bfunc(window(x,shiftx,shiftx+width))
                
                } ,seq(1,(length(x)-width))
        
        return(invisible(boxout))
        }

______________________________________________
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.

Reply via email to