US Immigration Enforcement – Part 1

[This article was first published on R-Projects – Stoltzmaniac, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Trend of US Immigration Enforcement

In the coming months I’ll be digging into the immigration enforcement data posted on data.world. I encourage anyone to take this data and either add to the project or to do something on their own. I will be bringing in external data sources to merge as well (which I did for this first plot).

If you’re only here for a “high-level nugget” of information, the basic thing you can see is:

Things have changed since 1925!

Using R packages ggplot2 and ggtheme, I produced a plot of the immigration enforcement data with the party of the POTUS shown in red and blue:


plot of chunk immigration enforcement plots


What’s going on here?

I am not a huge history buff, so when I noticed the big spike back in the early 1950’s I went to look it up. It’s certainly something worth reading about. It stemmed from the Bracero Program followed by Operation Wetback:

Operation Wetback was the culmination of more than a decade of intensifying immigration enforcement. Immigration enforcement actions (removals and returns) rose rapidly from a low of 12 thousand in 1942, to 727 thousand in 1952, the final year of the Truman Administration. Enforcement actions continued to rise under Eisenhower, until reaching a peak of 1.1 million in 1954, the year of Operation Wetback. Enforcement actions then fell by more than 90 percent in 1955, and 1956, and in 1957 were 69 thousand, the lowest number since 1944. The number of enforcement actions rose again in the 1960s and 1970s, but did not exceed the 1954 peak of Operation Wetback until 1986.

I apologize for what may be considered offensive or derogatory language but that’s what the operation was called.

Why is the political party of the POTUS on there?

The short answer – because it makes for a more interesting graph. In addition, immigration is a hot topic and presidents around the world have been discussing it for quite some time now (understatement). I certainly realize that the role of the POTUS has changed over the years. Obviously, there are A LOT of people who are involved in immigration enforcement policy, decision-making and execution. Simply using the party of the POTUS isn’t reflective of the overall picture. Over the last decade, the power for the POTUS to affect immigration decisions has grown drastically. It will be interesting to see what this chart looks like five years from now.

The code can be found on my GitHub Repo

The project and data can be found on my Data.World Project

library(data.world)
library(tidyverse)
library(gridExtra)
library(scales)
library(GGally)
library(lubridate)
library(ggthemes)

# Datasets are referenced by their URL or path
dataset_key <- "https://data.world/stoltzmaniac/insights-from-the-usa"

qry = data.world::qry_sql(sprintf("SELECT * FROM `%s`", "immigrationenforcement"))
data = data.world::query(qry, dataset = dataset_key)

qry = data.world::qry_sql(sprintf("SELECT * FROM `%s`", "presidents"))
presidents = data.world::query(qry, dataset = dataset_key)
presidents$left_office = as.Date(presidents$left_office,"%d/%m/%Y")

# Removing William Henry Harrison due to only serving 31 days in office... not his fault!
df.presidents = presidents %>%
  filter(president != 'William Henry Harrison') %>%
  mutate(year_took_office = as.integer(year(took_office)),
         year_left_office = as.integer(year(left_office))) %>%
  select(president,year_took_office, year_left_office, party)

#modify Calvin Coolidge so the data lines up at the beginning
df.presidents$year_took_office[df.presidents$president == 'Calvin Coolidge'] = 1925

df = data %>%
  left_join(df.presidents, by = c('year' = 'year_took_office')) %>% 
  arrange(year) %>% 
  fill(everything())
df$year = as.integer(df$year)
df$party = factor(df$party)
df %>% arrange(year)

p1 = ggplot(df, aes(x=year,y=apprehended)) +
  geom_bar(stat='identity',aes(fill=party)) + 
  geom_line(size=1) + 
  scale_y_continuous(labels = comma) + 
  theme(plot.title = element_text(hjust = 0.5)) + 
  scale_x_continuous(breaks = pretty(data$year, n = 10)) + 
  scale_fill_manual(values = c('#0052A5','#E0162B')) + 
  ggtitle('Apprehended') + 
  theme_fivethirtyeight()

p2 = ggplot(df, aes(x=year,y=removals)) + 
  geom_bar(stat='identity',aes(fill=party)) + 
  geom_line(size=1) + 
  scale_y_continuous(labels = comma) + 
  theme(plot.title = element_text(hjust = 0.5)) + 
  scale_x_continuous(breaks = pretty(data$year, n = 10)) + 
  scale_fill_manual(values = c('#0052A5','#E0162B')) + 
  ggtitle('Removals') + 
  theme_fivethirtyeight()

p3 = ggplot(df, aes(x=year,y=returns)) + 
  geom_bar(stat='identity',aes(fill=party)) + 
  geom_line(size=1) + 
  scale_y_continuous(labels = comma) + 
  theme(plot.title = element_text(hjust = 0.5)) + 
  scale_x_continuous(breaks = pretty(data$year, n = 10)) + 
  scale_fill_manual(values = c('#0052A5','#E0162B')) + 
  ggtitle('Returns') + 
  theme_fivethirtyeight()

grid.arrange(p1, p2, p3, ncol = 1)

To leave a comment for the author, please follow the link and comment on their blog: R-Projects – Stoltzmaniac.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)