This function computes a lagged vector, shifting it back or forward.
Usage
lagk(x, k, na = FALSE, cst = FALSE)
Arguments
x
A vector.
k
integer. The number of lags.
If k < 0, la serie est avancee au lieu d'etre retardee.
na
logical. If na = TRUE and k > 0
(resp. k < 0), the |k| holes created in the lagged vector
are put to NA; otherwise, the imputation depends on cst.
cst
logical.
If na = FALSE and cst = TRUE, the |k| holes
created in the lagged vector are put to x[[1L]]
(or to x[[length(x)]] if k < 0).
If na = FALSE and cst = FALSE,
these |k| holes are imputed by the k
first values of x (or the k last values if k < 0).