zip_choropleth_acs: Create a US ZIP choropleth from ACS data

Description Usage Arguments Value References See Also Examples

Description

Creates a US ZIP choropleth using the US Census' American Community Survey (ACS) data. Requires the acs package to be installed, and a Census API Key to be set with the acs's api.key.install function. Census API keys can be obtained at http://www.census.gov/developers/tos/key_request.html.

Usage

1
2
3
zip_choropleth_acs(tableId, endyear = 2011, span = 5, num_colors = 7,
  state_zoom = NULL, county_zoom = NULL, msa_zoom = NULL,
  zip_zoom = NULL)

Arguments

tableId

The id of an ACS table

endyear

The end year of the survey to use. See acs.fetch (?acs.fetch) and http://1.usa.gov/1geFSSj for details.

span

The span of time to use. See acs.fetch and http://1.usa.gov/1geFSSj for details. on the same longitude and latitude map to scale. This variable is only checked when the "states" variable is equal to all 50 states.

num_colors

The number of colors on the map. A value of 1 will use a continuous scale. A value in [2, 9] will use that many colors.

state_zoom

An optional vector of State names to zoom in on. Elements of this vector must exactly match the names of the state names as they appear in the "state.name" column of ?zip.regions.

county_zoom

An optional vector of county FIPS codes to zoom in on. Elements of this vector must exactly match the names of zips as they appear in the "county.fips.numeric" column of ?zip.regions.

msa_zoom

An optional vector of MSA (Metroplitan/Micropolitan Statistical Area) names to zoom in on. Elements of this vector must exactly match the names of the state names as they appear in the "cbsa.title" column of ?zip.regions.

zip_zoom

An optional vector of zip codes to zoom in on. Elements of this vector must exactly match the names of zips as they appear in the "region" column of ?zip.regions.

Value

A choropleth.

References

Uses the acs package created by Ezra Haber Glenn.

See Also

api.key.install in the acs package which sets an Census API key for the acs library

http://factfinder2.census.gov/faces/help/jsf/pages/metadata.xhtml?lang=en&type=survey&id=survey.en.ACS_ACS which contains a list of all ACS surveys.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
# Median income of all ZCTAs in New York State
zip_choropleth_acs("B19301", state_zoom="new york")

# 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)

# 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))

# 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")

## End(Not run)

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