rural <- get_decennial(geography = "state",
variables = c("P001001", "P002005"),
year = 2010,
output = "wide",
geometry = TRUE) %>%
rename(state = NAME) %>%
mutate(prop_rural = P002005/P001001,
state = reorder(state, prop_rural))
## Getting data from the 2010 decennial Census
rural %>%
filter(! state %in% c("Alaska", "Hawaii", "Puerto Rico")) %>%
ggplot(aes(fill = prop_rural)) +
geom_sf()

racevars <- c(White = "B02001_002",
Black = "B02001_003",
Asian = "B02001_005",
Hispanic = "B03003_003")
queens <- get_acs(geography = "tract",
variables = racevars,
year = 2018,
state = "NY",
county = "Queens",
geometry = TRUE,
summary_var = "B02001_001")
## Getting data from the 2014-2018 5-year ACS
queens %>%
mutate(Percent = 100 * (estimate / summary_est)) %>%
ggplot(aes(fill = Percent, color = Percent)) +
facet_wrap(~ variable) +
geom_sf() +
scale_fill_viridis_c(direction = -1) +
scale_color_viridis_c(direction = -1) +
labs(title = "Racial geography of Queens, NY",
caption = "Source: American Community Survey 2014-2018") +
theme_void()
