us_states <- map_data("state") |> # state polygons (not used today)
rename("state" = "region")
us_counties <- map_data("county") |> # county polygons
rename("state" = "region", "county" = "subregion") |>
mutate(county = gsub(" ", "", county),
county = gsub("'","", county) |> tolower())
#unique(us_counties$county[us_counties$state=="louisiana"]) # note issue Louisiana counties
cnty2019_all <- county_2019
#unique(cnty2019_all$name[cnty2019_all$state=="Louisiana"]) # note issue Louisiana counties
cnty2019_all <- cnty2019_all |>
mutate(state = tolower(state),
county = tolower(name),
county = gsub(" county", "", county),
county = gsub(" parish", "", county),
county = gsub("\\.", "", county), # \\ is required because . used in R coding
county = gsub(" ", "", county),
county = gsub("'","", county)) |>
relocate(county, .before=name)
cnty2019_all <- full_join(us_counties,cnty2019_all) # geo data and demographic data