library(ggthemes)
## Warning: package 'ggthemes' was built under R version 4.3.1
nj_2016 <- sf::st_read("~/Downloads/nj_2016/nj_2016.shp")
## Reading layer `nj_2016' from data source 
##   `/Users/anamikanaidu/Downloads/nj_2016/nj_2016.shp' using driver `ESRI Shapefile'
## Simple feature collection with 6339 features and 19 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 193684.7 ymin: 34945.75 xmax: 657059.7 ymax: 919549.4
## Projected CRS: NAD83 / New Jersey (ftUS)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.3.1
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
nj_2016 <- nj_2016 %>%
  mutate(clinton_share = G16PREDCLI / (G16PRERTRU + G16PREDCLI))

nj_2016 <- sf::st_make_valid(nj_2016)
  
ggplot2::ggplot() +
  ggplot2::geom_sf(data = nj_2016, ggplot2::aes(fill = clinton_share), color = "black", alpha = 0.7) +
  ggplot2::theme_minimal() +
  ggplot2::scale_fill_gradient2(low = "blue", mid = "white", high = "red",
                       midpoint = 0.5,
                       limits = c(0, 1), 
                       na.value = "grey50",  
                       name = "2016 Clinton NJ %") +
  ggplot2::labs(title = "NJ Clinton Percent 2016")