library(tidycensus)
library(tidyverse)
census_api_key("962c5d6aee465e30a4983ce885560bf1cbbe5375")
fl <- load_variables(2022, "acs5", cache = TRUE)
fl <- get_acs(geography = "county",
variables = c(tot_pop = "B01003_001", hispanic = "B03001_002"),
state = "FL",
geometry = TRUE,
year = 2022)
fl_wider <- fl|>
select(-moe) |>
pivot_wider(names_from = variable, values_from = estimate) |>
mutate(Hispanic_pct = hispanic/tot_pop)
fl_wider |>
ggplot(aes(fill = Hispanic_pct)) +
geom_sf(color = NA) +
scale_fill_viridis_c(option = "magma")