lagk | R Documentation |
Given a variable, create a k lagged version, optionally do it by a grouping factor, such as an ID.
lagk(x, k = 1, by)
x |
the variable to lag |
k |
the length to lag it |
by |
a variable to lag by. Must be sorted. |
a vector of the lagged values
lagk(1:4, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.