Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
df_rdd %>%
filter(year >= 1945, living_day_imp_post > 0) %>%
mutate(won = ifelse(margin_pct_1 >= 0, 1, 0),
margin = margin_pct_1) %>%
mutate(id = paste0(death_date_imp, "-", cand_last)) %>%
group_by(id) %>%
mutate(election = seq_along(id)) %>%
ungroup() %>%
filter(abs(margin) < 5, election == 1) %>%
with(lm(living_day_imp_post ~ won + margin + living_day_imp_pre)) %>%
summary()
broom::tidy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment