## code to prepare `social_vulnerability_index` dataset goes here
library(readr)
library(janitor)
library(fs)
library(here)
library(sf)
library(tigris)
options(tigris_use_cache = TRUE)
library(dplyr)
library(data.table)
# https://www.atsdr.cdc.gov/placeandhealth/svi/data_documentation_download.html
# Social Vulnerability Index
# Downloaded 2021-07-07
explorer_fname <- here(path('data-raw'), "raw_social_vulnerability_index.csv")
svi <- readr::read_csv(explorer_fname) %>%
clean_names()
sc_tracts <- tracts(state = 45) %>%
clean_names() %>%
st_drop_geometry() %>%
mutate(fips = as.double(geoid))
social_vulnerability_index <- dplyr::left_join(x = svi, y = sc_tracts, by = 'fips') %>%
select(c('fips','rpl_themes','intptlat','intptlon')) %>%
rename(tract_latitude = intptlat, tract_longitude = intptlon, geoid = fips, svi_value = rpl_themes)
fwrite(social_vulnerability_index, file = here(path('data-raw'), 'sc_svi.csv'))
usethis::use_data(social_vulnerability_index, overwrite = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.