You can make choropleths of selected demographic information from the US Census Bureau with the function ?zip_choropleth_acs. It functions analogously to the other "_acs" functions in the main choroplethr package. Please see the vignette "Mapping Census Data" on the choroplethr CRAN page for additional details.

What makes zip_choropleth_acs unique is the number of zoom options. In addition to viewing all ZIPs in the country you can select ZIPs by State, County, Metropolitan Statistical Area (MSA) as well as manually specify a number of ZIPs. Here are examples using table B19301 (per capita income):

All ZCTAs in a State

library(choroplethrZip)
# Per capita income of all ZCTAs in New York State
zip_choropleth_acs("B19301", state_zoom="new york")

Note that zip_choropleth_acs will often emit warnings because demographic information is not available for every ZCTA.

All ZCTAs in Selected Counties

library(choroplethrZip)
# zoom in on all ZCTAs in the 5 counties (boroughs) of New York City
nyc_fips = c(36005, 36047, 36061, 36081, 36085)
zip_choropleth_acs("B19301", county_zoom=nyc_fips)

Manually Selecting ZCTAs

library(choroplethrZip)
# compare Manhattan's Lower East Side and Upper East Side
manhattan_les = c("10002", "10003", "10009")
manhattan_ues = c("10021", "10028", "10044", "10128")
zip_choropleth_acs("B19301", num_colors=1, zip_zoom=c(manhattan_les, manhattan_ues))

All ZCTAs in a Metropolitan Statistical Area (MSA)

library(choroplethrZip)
# show all ZCTAs in the New York Metropolitan Statistical Area (MSA)
zip_choropleth_acs("B19301", msa_zoom="New York-Newark-Jersey City, NY-NJ-PA")

All ZCTAs in the USA

Here is an example of viewing all ZCTAs in the country. While interesting to look at, this map has two problems: 1) it takes a few minutes to render and b) due to the large number (32,989) and irregular shape of ZCTAs, it can sometimes be hard to read. I have found that experimenting with the number of colors can be especially useful for this map.

zip_choropleth_acs("B19301")


arilamstein/choroplethrZip documentation built on May 10, 2019, 1:27 p.m.