Get data from the U.S. Census Bureau's American Community Survey and calculate the Social Vulnerability Index for the specified region(s)
Source:R/svi_calculation.R
calculate_svi.Rd
Get data from the U.S. Census Bureau's American Community Survey and calculate the Social Vulnerability Index for the specified region(s)
Usage
calculate_svi(
geography,
year = 2022,
state = NULL,
county = NULL,
region = NULL,
geometry = FALSE,
include_adjunct_vars = FALSE,
key = NULL,
moe_level = 90,
cache_table = FALSE,
...
)
Arguments
- geography
The desired geographic scale for the SVI. Can be "county" or "tract"
- year
The end year of the 5-year ACS data to be used (Default: 2020).
- state
An optional vector of states for which you are requesting data. State names and FIPS codes are accepted. Defaults to NULL.
- county
The county for which you are requesting data. County names and FIPS codes are accepted. Must be combined with a value supplied to
state
. Defaults to NULL.- region
An sf object used to spatially filter the geography before calculating the SVI
- geometry
if FALSE (the default), return a regular tibble of ACS data. if TRUE, uses the tigris package to return an sf tibble with simple feature geometry in the
geometry
column.- include_adjunct_vars
if FALSE (the default) only include the variables used to calculate the SVI. If TRUE, include additional adjunct variables which can be used to explain more about local areas in certain circumstances.
- key
Your Census API key. Obtain one at https://api.census.gov/data/key_signup.html
- moe_level
The confidence level of the returned margin of error. One of 90 (the default), 95, or 99.
- cache_table
Whether or not tidycensus should cache table names for faster future access. Defaults to FALSE.
- ...
Other keyword arguments
Examples
if (FALSE) { # \dontrun{
library(tidycensus)
library(tidyverse)
library(svibuildr)
census_api_key("YOUR KEY GOES HERE")
nh_svi_county <- get_svi(geography = "county", state = "NH", geometry = TRUE)
ggplot(nh_svi_county, aes(fill = rpl_themes)) +
geom_sf() +
coord_sf(crs = 4258) +
scale_fill_viridis()
} # }