View source: R/helpers-difference-in-differences.R
lag_by_group | R Documentation |
See https://book.declaredesign.org/observational-causal.html#difference-in-differences
lag_by_group(x, groups, n = 1, order_by, default = NA)
x |
Vector of values |
groups |
Grouping variable |
n |
Positive integer of length 1, giving the number of positions to lead or lag by |
order_by |
Ordering variable withing group (e.g., time) |
default |
Value used for non-existent rows. Defaults to NA. |
vector of lagged values
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.