Last active
November 5, 2022 19:26
-
-
Save cbgoodman/1c129fa258714e60468da773118971a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("tidyverse") | |
library("tidycensus") | |
census_api_key("INSERT_API_KEY") | |
wright <- get_acs( | |
state = "MN", | |
county = "Wright", | |
geography = "county subdivision", | |
variables = "B19013_001", | |
geometry = TRUE, | |
year = 2020 | |
) %>% | |
# filter out the townships | |
filter(str_detect(NAME, regex("city", ignore_case = TRUE))) | |
# get the county outline | |
wright_county <- get_acs( | |
state = "MN", | |
county = "Wright", | |
geography = "county", | |
variables = "B19013_001", | |
geometry = TRUE, | |
year = 2020 | |
) | |
ggplot() + | |
geom_sf(wright_county, mapping = aes(), color = "black") + | |
geom_sf(wright, mapping = aes(), color = NA, fill = "white") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment