find_svi {findSVI} | R Documentation |
Retrieve census data and calculate SVI for one or multiple year(s)/state(s)
Description
find_svi()
is like a wrapper for get_census_data()
and
get_svi()
that retrieves census data and produces SVI for one or
multiple years(s) and state(s). For multiple year-state entries, SVI is
obtained from percentile rankings for each entry and summarised into one
table. 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
find_svi(year, state = NULL, geography, key = NULL, full.table = FALSE)
Arguments
year |
A vector containing years of interest (available 2012-2021).
Length >=1. Acting as pairs with |
state |
A vector containing states of interest. Length >=0. Length 0
( |
geography |
One geography level of interest for all year-state combination (e.g."county", "zcta", "tract"). |
key |
Your Census API key. Obtain one at
https://api.census.gov/data/key_signup.html. To set up, use
|
full.table |
Default as |
Value
A tibble of summarised SVI for one or multiple year-state combination(s)
of interest. Rows represent the geographic units, and columns represent its
SVI for each theme and all themes. Additional two columns at the end
indicate the corresponding state and year information. For full.table = TRUE
, estimated count and percentage values for individual SVI variables
are also included. For description of variable names (column names), please
refer to CDC/ATSDR documentation.
Examples
# Census API key required
# For one year-state entry
find_svi(
year = 2019,
state = "AZ",
geography = "county"
)
# For multiple year-state pairs
## All ZCTAs for 2017-AZ; 2017-DE; and 2018-DC
year <- c(2017, 2017, 2018)
state <- c("AZ", "DE", "DC")
info <- data.frame(year, state)
find_svi(
year = info$year,
state = info$state,
geography = "zcta"
)