Created
July 3, 2017 22:18
-
-
Save robwschlegel/c511b28c2f4a4460e5a5e5a45da80195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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