census_geo_api {wru} | R Documentation |
census_geo_api
retrieves U.S. Census geographic data for a given state.
census_geo_api( key, state, geo = "tract", age = FALSE, sex = FALSE, retry = 0, save_temp = NULL )
key |
A required character object. Must contain user's Census API key, which can be requested here. |
state |
A required character object specifying which state to extract Census data for,
e.g., |
geo |
A character object specifying what aggregation level to use.
Use |
age |
A |
sex |
A |
retry |
The number of retries at the census website if network interruption occurs. |
save_temp |
File indicating where to save the temporary outputs. Defaults to NULL. If specified, the function will look for an .RData file with the same format as the expected output. |
This function allows users to download U.S. Census 2010 geographic data, at either the county, tract, block, or place level, for a particular state.
Output will be an object of class list
, indexed by state names. It will
consist of the original user-input data with additional columns of Census geographic data.
Relies on get_census_api, get_census_api_2, and vec_to_chunk functions authored by Nicholas Nagle, available here.
## Not run: census_geo_api(key = "...", states = c("NJ", "DE"), geo = "block") ## Not run: census_geo_api(key = "...", states = "FL", geo = "tract", age = TRUE, sex = TRUE)