get_min_year | R Documentation |
This function returns the earliest year where an indicator == 1.
If indicator never equals zero, return Inf.
This is most useful with
mutate(.by = unit, g = get_min_year(year, treat))
or
DT(j = g := get_min_year(year, treat), by = unit)
to convert between d and g variable in panel data.
get_min_year(t, d)
t |
Vector of years |
d |
Vector of 0/1 for treatment |
Returns earliest y for which t == 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.