[R] Comparing lagged time series

j taecha taecha888 at hotmail.com
Sat Oct 27 18:04:55 CEST 2007


As a newbie to R I have the following question. I would like to compare values in a time series with values of the same series x observations ago. In gretl this is simply done like so: 

In R, I seem not to get it working. I have tried lag(data,-x) to obtain the lagged time series which produces the following error message:

Error in attr(x, "tsp") <- c(1, NROW(x), 1) : 
        invalid time series parameters specified

Can anyone enlighten me on how to accomplish this task in R?

Thanks.



More information about the R-help mailing list