This function builds lags of a variable up to the n
lag.
lag_vars(df, col = NULL, lags = 1, mutate_type = c("mutate", "trans"))
dataframe or tibble
string - specify the column/field/variable for differencing.
number - specify the number of lags for differencing.
string - select whether to mutate()
or transmute()
from dplyr.
A dataframe with the lags of the column specified.
Build the lags of a variable.