# Vote by Mail data

library("dplyr")
library("ggplot2")

# Data

Today I am going to try to make a choropleth (map + data) of the percentage of registered voters that sent in ballots for the 2018 elections in the USA. I gathered the data from and by the following sites:

states <- tolower( sort(c(state.name, "District of Columbia")))
voted2018 <- c(2,5,62,1,54,88,4,3,2,25,4,38,9,6,17,16,10,1,2,18,4,2,15,21,3,6,63,15,6,5,10,36,3,2,NA,13,4,104,3,4,2,15,1,4,89,6,2,92,1,5,22)
vote_data <- data.frame(states, voted2018)

The 538 article’s table caption included the following notes:

• “It’s not possible to calculate these numbers for North Dakota, as it doesn’t have voter registration. However, it does have a relatively high rate of mail voting — 23 percent of its votes were cast by mail in 2016, and 29 percent in 2018. Republicans control both the governorship and state legislature in North Dakota.”
• “When asked how Oregon mailed ballots to 104 percent of voters in 2018, state election officials responded that the EAC number was “off” but did not provide further details."
• Sources: Ballotpedia, U.S. Election Assistance Commission

# Choropleth

Adapted from Choropleth Map in ggplot2 by ‘data technik’

states_map <- map_data("state")
fact_join <- left_join(states_map, vote_data, by = c("region" = "states"))
fact_join %>%
ggplot(aes(long, lat, group = group)) +
geom_polygon(aes(fill = voted2018), color = "black") +
scale_fill_viridis_c(option = "C") +
labs(title = "A View of Voting by Mail",
subtitle = "Percentage of registered voters that sent in ballots in 2018",
caption = "Alaska: 2%, Hawaii: 38%, North Dakota: NA \n Data Source: FiveThirtyEight",
fill = "% voted by mail",
x = "",
y = "") +
theme(axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.ticks.x = element_blank(),
axis.ticks.y = element_blank(),
panel.background = element_rect(fill = "white"))