# lag

##### Lag a Time Series

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.

- Keywords
- ts

##### Usage

`lag(x, …)`# S3 method for default
lag(x, k = 1, …)

##### Arguments

- x
A vector or matrix or univariate or multivariate time series

- k
The number of lags (in units of observations).

- …
further arguments to be passed to or from methods.

##### Details

Vector or matrix arguments `x`

are given a `tsp`

attribute
*via* `hasTsp`

.

##### Value

A time series object with the same class as `x`

.

##### Note

Note the sign of `k`

: a series lagged by a positive `k`

starts *earlier*.

##### References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
*The New S Language*.
Wadsworth & Brooks/Cole.

##### See Also

##### Examples

`library(stats)`

```
# NOT RUN {
lag(ldeaths, 12) # starts one year earlier
# }
```

*Documentation reproduced from package stats, version 3.6.1, License: Part of R 3.6.1*

### Community examples

Looks like there are no examples yet.