get_census_data {findSVI} | R Documentation |
Retrieve American Community Survey data for SVI variables
Description
This function uses tidycensus::get_acs()
with a pre-defined
list of variables to retrieves ACS data for SVI calculation. Note that a
Census API key is required for this function to work, which can be obtained
at https://api.census.gov/data/key_signup.html and set up using
tidycensus::census_api_key()
.
Usage
get_census_data(
year,
geography,
state = NULL,
county = NULL,
key = NULL,
geometry = FALSE,
...
)
Arguments
year |
The year of interest (available 2012-2021). |
geography |
The geography of interest (eg. state, county, zcta, tract) |
state |
(Optional) Specify the state of interest. If data for multiple
states are retrieved together, ranking for SVI calculation will be
performed among all states. |
county |
(Optional) Specify the county(s) of interest, must be combined with a value supplied to "state". |
key |
Your Census API key. Obtain one at
https://api.census.gov/data/key_signup.html. Include it in this argument
or set up your key using |
geometry |
Default as |
... |
Other arguments; more details please see |
Value
A tibble of ACS data with each row represents an enumeration (geographic) unit and each column represents a census variable ("wide" form).
Examples
# Census API key required
get_census_data(year = 2018,
geography = "county",
state = "PA")