[R] rollapply() opertation on time series

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jul 29 00:41:20 CEST 2008


rollapply along an index:

library(zoo)
z <- zoo(matrix(101:110, 5), 201:205)
tt <- time(z)
zz <- zoo(seq_along(tt), tt)
out <- rollapply(zz, 3, function(ix) list(z[ix,]))
str(out) # list of zoo objects


On Mon, Jul 28, 2008 at 5:03 PM, rcoder <mpdotbook at gmail.com> wrote:
>
>
> rcoder wrote:
>>
>> Hi everyone,
>>
>> Is there a way to perform a rollapply operation on a time series data
>> matrix and preserve the time frame? Currently, when I apply rollapply in
>> its standart form, the date column is no longer present in the o/p matrix.
>>
>> Thanks,
>>
>> rcoder
>>
>
> --
> View this message in context: http://www.nabble.com/rollapply%28%29-opertation-on-ts-matrix-tp18694735p18699707.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list