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.
______________________________________________ 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.