Last chance! 50% off unlimited learning
Sale ends in
Compute a lagged version of a time series, shifting the time base back by a given number of observations.
lag
is a generic function; this page documents its default
method.
lag(x, …)# S3 method for default
lag(x, k = 1, …)
A vector or matrix or univariate or multivariate time series
The number of lags (in units of observations).
further arguments to be passed to or from methods.
A time series object with the same class as x
.
Vector or matrix arguments x
are given a tsp
attribute
via hasTsp
.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
# NOT RUN {
lag(ldeaths, 12) # starts one year earlier
# }
Run the code above in your browser using DataLab