Description Usage Arguments Details Value Author(s)
shiftData implements lead/lag/dif operations on a data.table and returns a resulting dataset.
1 2 |
data |
input dataset. Must be a data.table. |
var |
character vector with names of variables that should be modified |
replace |
replace the original variables. If FALSE (by default), the modified variables are added to the original dataset, with a suffix added to the name of the original variables. |
by |
character vector with name(s) of by groups. |
lag |
number of lags (negative) or leads (positive). |
dif |
take a difference? Default is FALSE. |
relative |
relative differences? Applicable only if dif=TRUE. |
.. content for ..
data.table with the resulting dataset.
Janko Cizel
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.