getShiftedValues | R Documentation |
Function for creating lagged/leading value variables from LONG data.
getShiftedValues(
data_table,
shift_group=c("ID", "CONTENT_AREA"),
shift_period="YEAR",
shift_variable="SCALE_SCORE",
shift_amount=1L,
shift_type="lag")
data_table |
Data table to add lagged/leading variable(s) to. |
shift_group |
Variable(s) indicating groups for which to create lagged/leading variables for. |
shift_period |
Variable indicating what period the lagged/leading shift occurs relative to. |
shift_variable |
Variable that lagged/leading values are derived from. |
shift_amount |
Number of period(s) that the shift_variable is shifted relative to the shift_period. |
shift_type |
Either "lag" or "lead". |
Typical use of the function is to create prior scale score for students from a LONG formatted longitudinal file.
Function returns the submitted data_table
and appends additional variables with suffixes added to the shift_variable
name. For example SCALE_SCORE_LAG_1
.
Damian W. Betebenner dbetebenner@nciea.org
## Not run:
getShiftedValues(SGPdata::sgpData_LONG)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.