[R] R: lags and plots

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Tue Feb 3 15:29:38 CET 2004


On Tue, 03 Feb 2004 13:57:53 +0200 allan clark wrote:

> Hi all
> 
> I want to calculate certain lags of a time series and plot them
> simultaneously on a graph. can anyone help?

Something like this?

R> x <- ts(cumsum(rnorm(20)), start = 0, freq = 10)
R> plot(x)
R> lines(lag(x, k = -1), col = 4)

hth
Z




More information about the R-help mailing list