Created
March 16, 2020 20:53
-
-
Save hepplerj/76fd402f403d1fbb3be7003bab37f717 to your computer and use it in GitHub Desktop.
Percentage of residents who take public transportation to work
This file contains 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(tidycensus) | |
library(tidyverse) | |
# If not set, un-comment below and install your Census API key (https://api.census.gov/data/key_signup.html) | |
# census_api_key("YOUR KEY HERE", install = TRUE) | |
get_acs(geography = "metropolitan statistical area/micropolitan statistical area", | |
variables = "DP03_0021PE", | |
summary_var = "B01003_001", | |
survey = "acs1", | |
year = 2016) %>% | |
filter(summary_est > 2000000) %>% | |
mutate(NAME = gsub("Metro Area", "", NAME)) %>% | |
ggplot(aes(x = estimate, y = reorder(NAME, estimate))) + | |
geom_point(color = "steelblue", size = 2) + | |
labs(title = "Percentage of residents who take public transportation to work", | |
subtitle = "2016 1-year ACS estimates", | |
y = "", | |
x = "ACS estimate (percent)", | |
caption = "Source: ACS Data Profile variable DP03_0021P via the tidycensus R package") + | |
theme_minimal() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment