library(sf)
## Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.0     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
fl_2018 <-st_read("fl_2018/fl_2018.shp")
## Reading layer `fl_2018' from data source 
##   `/Users/nehabangalore/Desktop/Election Data Science/fl_2018/fl_2018.shp' 
##   using driver `ESRI Shapefile'
## Simple feature collection with 6152 features and 21 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -87.6349 ymin: 24.39631 xmax: -79.97431 ymax: 31.00097
## Geodetic CRS:  NAD83

ALACHUA COUNTY RON RESANTIS PERCENTAGE

florida_rondesantis <- fl_2018 |>
  mutate(rd = G18GOVRDES / (G18GOVRDES + G18GOVDGIL))
florida_2018 <- st_make_valid(fl_2018)
alachua_rondesantis <- florida_rondesantis |>
  filter(COUNTY == "ALA")
ggplot() + 
  geom_sf(data = alachua_rondesantis, aes(fill = rd), color = "black", alpha = 0.7) + 
  theme_minimal() + 
  scale_fill_gradient2(low = "blue", mid = "white", high = "red", 
                        midpoint = 0.5, 
                        limits = c(0,1), 
                        na.value = "grey50", 
                        name = "2018 Ron Desantis %") 

#Looks like central alachua is the place to be