acs_integration.Rmd
dhomer
allows users to calculate proximity and accessibility to various data points from a geographic address input in order to essentially compute adjacency to determinants of health. Many determinants of health are integrated into the Census Bureau American Community Survey population estimates collected every 1 and 5 years, respectively.
The tidycensus
package functions allows us to call and integrate ACS data into the dhomer
functions for more comprehensive determinants of health computation.
Three variables of related to determinants of health:
Estimates from the American Community Survey for below poverty, less than high school graduates and householder living alone are obtained and then divided by the population for the area since the data will be displayed on a map.
a_df <- suppressMessages(
get_acs(
variables = c(
"below_poverty" = "B17021_002",
"less_than_highschool" = "B06009_002",
"nonfamily_households" = "B11001_008"
),
state = "SC",
geography = "county",
geometry = TRUE,
cache_table = TRUE,
year = 2019,
summary_var = "B01003_001",
output = "wide"
)
)
a_df <- a_df %>%
mutate(percent_below_pov = below_povertyE/summary_est)
The counties show the percent population. Libraries are shown in blue.
qpal <- colorQuantile("RdYlBu", a_df$percent_below_pov, n = 5)
leaflet(data = a_df, width = "100%") %>%
addPolygons(data = a_df, stroke = FALSE, fillOpacity = 0.6, color = ~qpal(percent_below_pov)) %>%
addPolylines(weight = 2, color="gray") %>%
addCircles(data = libraries,
label = libraries$libname,
color = "blue") %>%
addLegend(title = "Percent Below Poverty",
opacity = 1,
pal = qpal,
values = ~a_df$percent_below_pov
)