Introduction

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.

Census Data Variables

Three variables of related to determinants of health:

  • B17021_002- Estimate!!Total:!!Income in the past 12 months below poverty level,
  • B06009_002- Estimate!!Total:!!Less than high school graduate,
  • B11001_008- Estimate!!Total:!!Nonfamily households:!!Householder living alone

Fetching Census Data

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)

Libraries

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
)