“Voter Registrations Are Way, Way Down During the Pandemic” (Jun 26, 2020) by Kaleigh Rogers and Nathaniel Rakich
https://fivethirtyeight.com/features/voter-registrations-are-way-way-down-during-the-pandemic/
How are graphics used to tell the author’s story?
What geometries are used?
What does the raw data look like?
library(tidyverse)
# Import data
vreg<-read.csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/voter-registration/new-voter-registrations.csv",
header=TRUE)
head(vreg)
## Jurisdiction Year Month New.registered.voters
## 1 Arizona 2016 Jan 25852
## 2 Arizona 2016 Feb 51155
## 3 Arizona 2016 Mar 48614
## 4 Arizona 2016 Apr 30668
## 5 Arizona 2020 Jan 33229
## 6 Arizona 2020 Feb 50853
Relevel the data so that its in the right order:
# Level the Month variable so that its in the right order (ie not alphabetical)
vreg$Month<-factor(vreg$Month,
levels=c("Jan", "Feb", "Mar", "Apr", "May"))
### USE spread() FROM tidyr
vregYear<-vreg%>%
spread(Year, New.registered.voters)
### RENAME THE COLUMNS
colnames(vregYear)<-c("Jurisdiction", "Month", "Y2016", "Y2020")
Add change in registration.
### mutate() FROM dplyr()
vregChange<-vregYear%>%
mutate(change=Y2020-Y2016)%>%
mutate(positive=change>0)
ggplot(data=vregChange, aes(x=Month, y=change, fill=positive))+
geom_col()+
facet_wrap(.~Jurisdiction, scales="free_y")