Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# Calculate residuals
green_card_resids <- augment(lm(Number~Year, data = green_card))
green_card_resids <- merge(green_card_resids, party_year, by = "Year")
# Plot them
ggplot(data = green_card_resids, aes(x = Year, y = .resid)) +
geom_col(aes(fill = Party), colour = "black") +
geom_smooth(method = "lm", colour = "black") +
labs(x = NULL, y = "Green Cards Granted") +
scale_fill_manual(values = c("slateblue1", "firebrick1"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment