-
-
Save juliasilge/38f08ae0c8f2f46ade766dff29ca9bd6 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(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", | |
endyear = 2016) %>% | |
filter(summary_est > 2000000) %>% | |
mutate(NAME = gsub("Metro Area", "", NAME)) %>% | |
ggplot(aes(x = estimate, y = reorder(NAME, estimate))) + | |
geom_point(color = "navy", size = 2.5) + | |
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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment