lag {timeSeries} | R Documentation |
Compute a lagged version of a 'timeSeries' object.
## S4 method for signature 'timeSeries'
lag(x, k = 1, trim = FALSE, units = NULL, ...)
k |
[lagSeries] - |
trim |
a logical value. By default |
units |
an optional character string, which allows to overwrite the
current column names of a |
x |
an object of class |
... |
arguments passed to other methods. |
returns a lagged S4 object of class 'timeSeries'.
## Load Micsrosoft Data Set -
x = MSFT[1:20, "Open"]
## Lag the timeSeries Object:
lag(x, k = -1:1)