Description Usage Arguments Details Value Source See Also
The function shifts a vector up or down to create lag or lead variables. Note: your data needs to be sorted by date. The date should be ascending (i.e. increasing as it moves down the rows).
1 |
VarVect |
a vector you would like to shift (create lag or lead). |
shiftBy |
numeric value specifying how many rows (time units) to shift the data by. Negative values shift the data down–lag the data. Positive values shift the data up–lead the data. |
reminder |
logical. Whether or not to remind you to order your data by
the |
shift
a function for creating lag and lead variables, including for
time-series cross-sectional data.
a vector
Largely based on TszKin Julian's shift
function:
http://ctszkin.com/2012/03/11/generating-a-laglead-variables/.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.