On Tue, Jan 4, 2011 at 8:20 AM, Bogaso Christofer <[email protected]> wrote: > Hi all, in the zoo package there is a function rollapply() to apply some > fixed function on rolling window basis. I am looking for some same sort of > function on **temporal sampling basis** means, I would like to apply a > function say mean() for data window of length 30 like observations for 1:30, > 31:60, . so on. > > > > Is there any facility to doing that directly? >
The by= argument of rollapply does that: > library(zoo) > z <- zoo(1:9) > rollapply(z, 3, by = 3, mean) 2 5 8 2 5 8 -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com _______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
