Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# Libraries
library(tidyverse)
library(lubridate)
library(broom)
library(gridExtra)
# President data
data(presidential)
presidential$start <- year(presidential$start)
presidential$end <- year(presidential$end)-1
# Create index of party years
# I couldn't think of a clever automatic way of doing this...
party_year <- data.frame(Year = seq(1953, 2016), Party = c(rep("Republican",8), rep("Democrat",8),
rep("Republican",8), rep("Democrat",4),
rep("Republican",12), rep("Democrat",8),
rep("Republican",8), rep("Democrat",8)))
# Immigration data
green_card <- read_csv("../data/Persons Obtaining Lawful Permanent Resident Status-Fiscal Years 1820 to 2015.csv")
green_card <- merge(green_card, party_year, by = "Year")
removals <- read_csv("../data/Aliens Removed Or Returned-Fiscal Years 1892 To 2015.csv")
removals <- merge(removals, party_year, by = "Year")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment