get_first_difference | R Documentation |
A function that calculates the first difference in a panel data setting. If the data.frame that is passed in has nxT rows, the resulting vector will also have nxT elements with one element for each unit set to be NA.
get_first_difference(df, idname, yname, tname)
df |
the data.frame used in the function |
idname |
name of column that holds the unit id |
yname |
name of column containing the outcome (or other variable) for which to calculate its outcome in the immediate pre-treatment period |
tname |
name of column that holds the time period |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.