Lag a vector
custom_lag(x, k = 1)
Vector (of any class).
Integer to specify the lag (defaults to 1).
A lagged vector (not a time series as opposed to stats::lag()). The behaviour of this lag() function is closer to that of dplyr::lag().
stats::lag()
lag()
dplyr::lag()