Given a variable, create a k lagged version,
optionally do it by a grouping factor, such as an ID.
lagk(x, k = 1, by)
the variable to lag
the length to lag it
a variable to lag by. Must be sorted.
a vector of the lagged values
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.
Questions? Problems? Suggestions? Tweet to @rdrrHQian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.