Looking at 2020 Election Results: Republican Votes in Presidential and Prosecutor Race (Hamilton County, Ohio)
Combine 2020 precincts and 2020 election results.
Make a copy with only the columns we need, (Trump, Biden, Deters, Rucker).
Find the differences in proportion of votes and of number of votes between Republican and Democratic opponents per race.
Use these columns to create maps to visualize these results by precinct.
results2020 <- read_excel("../data/election results/G20_Official_Canvass.xlsx", sheet = "Candidates",skip=1)
map <- st_zm(st_read("../data/maps/PRECINCT_052219.shp"))
Reading layer `PRECINCT_052219' from data source
`C:\Users\colle\Documents\GitHub\DSCI210-f24\data\maps\PRECINCT_052219.shp'
using driver `ESRI Shapefile'
Simple feature collection with 563 features and 1 field
Geometry type: MULTIPOLYGON
Dimension: XY, XYZ
Bounding box: xmin: -84.8203 ymin: 39.02153 xmax: -84.25651 ymax: 39.31206
z_range: zmin: 0 zmax: 0
Geodetic CRS: NAD83
mapANDresults2020 <-
left_join(map, results2020, by = c("PRECINCT" = "PRECINCT"))
columns <- mapANDresults2020 %>%
select(`PRC #`, `PRECINCT`, `REGISTERED VOTERS TOTAL`, `PERCENT`, `Biden & Harris (Dem)`, `Trump & Pence (Rep)`,`Joseph T. Deters (Rep)`, `Fanon A. Rucker (Dem)`) %>%
mutate(Trump.prop = `Trump & Pence (Rep)`/( `Biden & Harris (Dem)`+ `Trump & Pence (Rep)`)) %>%
mutate(Deters.prop = `Joseph T. Deters (Rep)`/(`Joseph T. Deters (Rep)` + `Fanon A. Rucker (Dem)`)) %>%
mutate(prop.difference.Rep = Deters.prop - Trump.prop) %>%
mutate(vote.difference.Rep = (`Joseph T. Deters (Rep)`) - (`Trump & Pence (Rep)`))
columns%>%
ggplot(aes(fill=prop.difference.Rep)) +
geom_sf()+
labs(title = "2020 (Deters minus Trump) Election Results",
subtitle = "",
fill = "Vote for Deters - Trump (%)",
caption = "")+
scale_fill_gradientn(colours=brewer.pal(n=10,name="PRGn"),na.value = "transparent",
breaks=c(-.05,0, .05, .1, .15, .2, .22),labels=c("-.05%", "0%", ".05%", "10%", "15", "20%", "22%"),
limits=c(-.05,.22))
columns%>%
ggplot(aes(fill=vote.difference.Rep)) +
geom_sf()+
labs(title = "2020 (Deters minus Trump) Election Results",
subtitle = "",
fill = "Vote for Deters - Trump (in # of votes)",
caption = "")+
scale_fill_gradientn(colours=brewer.pal(n=10,name="PRGn"),na.value = "transparent",
breaks=c(-10, 20, 50, 80, 110, 140, 170, 200, 220),labels=c("-10", "20", "50", "80", "110", "140", "170", "200", "220"),
limits=c(-10,220))
Are there any precincts that stand out?
Do the precincts with high percentages and vote counts of difference lie within our swing voters precincts?
Should these be our swing voters that we target?