I'm not sure if it's easily doable with a ts class, but the rollapply function in the zoo package will do this easily. (Also, I find zoo to be a much more natural time-series workflow than ts so it might make the rest of your life easier as well)
Michael On Thu, Jan 26, 2012 at 2:24 PM, Jorge Molinos <jgarc...@tcd.ie> wrote: > > Hi, > > I want to apply a function (in my case SDF; package “sapa”) repeatedly over > discrete sections of a daily time series object by sliding a time window of > constant length (e.g. 10 consecutive years or 1825 days) over the entire ts > at increments of 1 time unit (e.g. 1 year or 365 days). So for example, the > first SDF would be calculated for the daily values of my variable recorded > between years 1 to 5, SDF2 to those for years 2 to 6 and so on until the > total length of the series is covered. How can I implement this into a R > script? Any help is much appreciated. > > Jorge > ______________________________________________ > 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. ______________________________________________ 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.