Description Usage Arguments Value
Given a dataframe, createlag
returns a dataframe with lagged
variables. Lag function is applied by groups. Additional variables
that should not be lagged can be provided
1 2 |
df |
Dataframe whose variables must be lagged |
groupingvar |
Variables used to define group |
k |
Maximum lag that must be computed. If k>1, lags 1:k are computed |
labelvar |
Variables that should not be lagged |
A dataframe with lagged observations by groups
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.