zi_get_demographics {zippeR} | R Documentation |
Download Demographic Data for Five-digit ZCTAs
Description
This function returns demographic data for five-digit ZIP Code Tabulation Areas (ZCTAs), which are rough approximations of many (but not all) USPS ZIP codes.
Usage
zi_get_demographics(year, variables = NULL, table = NULL,
survey, output = "tidy", zcta = NULL, key = NULL)
Arguments
year |
A four-digit numeric scalar for year. |
variables |
A character scalar or vector of variable IDs. |
table |
A character scalar of a table ID (only one table may be requested per call). |
survey |
A character scalar representing the Census product. It can
be either a Decennial Census product (either |
output |
A character scalar; one of |
zcta |
An optional vector of ZCTAs that demographic data are requested
for. If this is |
key |
A Census API key, which can be obtained at
https://api.census.gov/data/key_signup.html. This can be omitted if
|
Value
A tibble containing all demographic data requested in either
"tidy"
or "wide"
format.
Examples
# download all ZCTAs
zi_get_demographics(year = 2012, variables = "B01003_001", survey = "acs5")
# limit output to subset of ZCTAs
## download all ZCTAs in Missouri, intersects method
mo20 <- zi_get_geometry(year = 2020, state = "MO", method = "intersect")
## download demographic data
zi_get_demographics(year = 2012, variables = "B01003_001", survey = "acs5",
zcta = mo20$GEOID)