Learn R Programming

cif (version 0.1.1)

lagn: lag j of matrix or vector y

Description

lagn(y,j,fill=NA) produces lag j of matrix or vector y, with fill in missing j cells REM: alternative to "lead-lag" dplyr which applies to vector y

Usage

lagn(y, j, fill = NA)

Arguments

y

column vector or matrix

j

number of lags

fill

value to be used to fill the missing values at the beginning, default = NA

Value

y lagged j cells, with fill in the missing j positions

References

Berta et al. 2020