lag
From timeSeries v3022.101.2
by Tobias Setz
Lag a Time Series
Compute a lagged version of a 'timeSeries' object.
- Keywords
- chron
Usage
"lag"(x, k = 1, trim = FALSE, units = NULL, ...)
Arguments
- k
- [lagSeries] - an integer value. The number of lags (in units of observations). By default 1.
- trim
-
a logical value. By default
TRUE
, the first missing observation in the return series will be removed. - units
-
an optional character string, which allows to overwrite the
current column names of a
timeSeries
object. By defaultNULL
which means that the column names are selected automatically. - x
-
an object of class
timeSeries
. - ...
- arguments passed to other methods.
Value
- returns a lagged S4 object of class 'timeSeries'.
Examples
library(timeSeries)
## Load Micsrosoft Data Set -
x = MSFT[1:20, "Open"]
## Lag the timeSeries Object:
lag(x, k = -1:1)
Community examples
Looks like there are no examples yet.