View source: R/zi_get_demographics.R
zi_get_demographics | R Documentation |
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.
zi_get_demographics(year, variables = NULL, table = NULL,
survey, output = "tidy", zcta = NULL, key = NULL)
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
|
A tibble containing all demographic data requested in either
"tidy"
or "wide"
format.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.