if (FALSE) {
# median income, all counties in US
county_choropleth_acs("B19301")
# continuous scale, zooing in on all counties in New York, New Jersey and Connecticut
county_choropleth_acs("B19301", num_colors=1, state_zoom=c("new york", "new jersey", "connecticut"))
# zooming in on the 5 counties (boroughs) that make up New York City
library(dplyr)
library(choroplethrMaps)
data(county.regions)
nyc_county_names=c("kings", "bronx", "new york", "queens", "richmond")
nyc_county_fips = county.regions %>%
filter(state.name=="new york" & county.name %in% nyc_county_names) %>%
select(region)
county_choropleth_acs("B19301", num_colors=1, county_zoom=nyc_county_fips$region)
}
Run the code above in your browser using DataLab