lag {timeSeries} | R Documentation |
Lag a 'timeSeries' object
Description
Compute a lagged version of a "timeSeries"
object.
Usage
## S3 method for class 'timeSeries'
lag(x, k = 1, trim = FALSE, units = NULL, ...)
Arguments
x |
an object of class |
k |
an integer number, the number of lags (in units of observations).
By default 1. Can also be a vector, in which case the result is a
multivariate |
trim |
a logical value. By default |
units |
an optional character string, which allows to overwrite the current
column names of a |
... |
arguments passed to other methods. |
Value
an object of class "timeSeries"
See Also
Examples
## Load Micsrosoft Data Set
x <- MSFT[1:20, "Open"]
## Lag the 'timeSeries' Object
lag(x, k = -1:1)
[Package timeSeries version 4032.109 Index]