Re: [R] Rolling window difference for zoo time series

2018-04-24 Thread Achim Zeileis
On Tue, 24 Apr 2018, Eric Berger wrote: Zoo_TS/lag(Zoo_TS) - 1 Or: diff(Zoo_TS, arithmetic = FALSE) - 1 On Tue, Apr 24, 2018 at 9:29 PM, Christofer Bogaso < bogaso.christo...@gmail.com> wrote: Hi, I have a 'zoo' time series as below : Zoo_TS = zoo(5:1, as.Date(Sys.time())+0:4) Now I w

Re: [R] Rolling window difference for zoo time series

2018-04-24 Thread Eric Berger
Zoo_TS/lag(Zoo_TS) - 1 On Tue, Apr 24, 2018 at 9:29 PM, Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Hi, > > I have a 'zoo' time series as below : > > Zoo_TS = zoo(5:1, as.Date(Sys.time())+0:4) > > Now I want to calculate First order difference of order 1, rolling > window basis i.e

[R] Rolling window difference for zoo time series

2018-04-24 Thread Christofer Bogaso
Hi, I have a 'zoo' time series as below : Zoo_TS = zoo(5:1, as.Date(Sys.time())+0:4) Now I want to calculate First order difference of order 1, rolling window basis i.e. (Zoo_TS[2] - Zoo_TS[1] ) / Zoo_TS[1] (Zoo_TS[3] - Zoo_TS[2] ) / Zoo_TS[2] . Is there any direct function available to ac