rpubs.com/drkblake/TNSnap2023

Overview

The Supplemental Nutrition Assistance Program (SNAP) is the largest federal nutrition assistance program in the United States. It provides monthly benefits that help eligible low-income individuals and households purchase food. Benefits are delivered through an Electronic Benefit Transfer (EBT) card, which can be used at authorized grocery stores, supermarkets, farmers’ markets, and other food retailers.

SNAP is designed to reduce food insecurity, support adequate nutrition, and improve the health and well-being of participants. Eligibility is based on income, household size, and other factors, and recipients must meet certain work and reporting requirements. The federal government funds and supervises SNAP, but state-level agencies operate it day to day.

The American Community Survey (ACS) five-year SNAP estimates provide reliable, small-area information on participation in the Supplemental Nutrition Assistance Program. By combining five years of survey data, the ACS produces statistically stable measures of the number and percentage of households receiving SNAP benefits. These estimates represent an average over the five-year period and are available for a range of geographic levels.

The maps below show the latest (2023) estimates for Census divisions within Rutherford County, Tennessee, and across other areas of the state. The maps are colored according to the percentage of households receiving SNAP benefits at any time during the past 12 months.

Clicking or tapping a division will display the estimated percentage, the range of the estimate’s 90-percent confidence interval, and the estimated total number of SNAP households in the division.

Rutherford County

This map shows the estimated percentage of households receiving SNAP benefits within each Census division in Rutherford County. The figure below the map shows each division’s estimate along with the estimate’s error margin. Estimates with overlapping error margins do not differ significantly.


Percent of households receiving SNAP benefits, Rutherford County, Tennessee


Nashville area

This map shows the percentage of households receiving SNAP benefits within each Census division in Rutherford, Davidson, and Williamson counties in Tennessee. The table below the map shows the county-wide figures for each county on the map.


Percent of households receiving SNAP benefits, Nashville area

Household-Level Estimates by County
Nashville-Area Counties (2019–2023 ACS 5-Year Estimates)
County Percent (%) Margin of Error Households
Davidson County, Tennessee 8.6 0.4 27,113
Robertson County, Tennessee 7.6 1.2 2,116
Rutherford County, Tennessee 7.4 0.7 9,286
Sumner County, Tennessee 6.6 0.8 5,032
Wilson County, Tennessee 6.1 0.9 3,430
Cheatham County, Tennessee 5.7 1.3 912
Williamson County, Tennessee 2.1 0.6 1,898

Tennessee

This map shows the percentage of households receiving SNAP benefits within each Census division across Tennessee.


Percent of households receiving SNAP benefits, Tennessee


R code:

This R code produced the maps displayed above. Notes:

# ============================================================
# 0. INSTALL AND LOAD REQUIRED PACKAGES
# ============================================================

if (!require("tidyverse"))
  install.packages("tidyverse")
if (!require("tidycensus"))
  install.packages("tidycensus")
if (!require("sf"))
  install.packages("sf")
if (!require("mapview"))
  install.packages("mapview")
if (!require("leaflet"))
  install.packages("leaflet")
if (!require("leaflet.extras2"))
  install.packages("leaflet.extras2")
if (!require("gt"))
  install.packages("gt")
if (!require("gtExtras"))
  install.packages("gtExtras")
if (!require("plotly"))
  install.packages("plotly")

library(tidyverse)
library(tidycensus)
library(sf)
library(mapview)
library(leaflet)
library(leafpop)
library(gt)
library(gtExtras)
library(plotly)

# ============================================================
# 1. CENSUS API KEY
# ============================================================

# NOTE: Replace PasteYourAPIKeyBetweenTheseQuoteMarks with
# your actual API key, and delete the # in front of 
# census_api_key. If you don't the script won't work.
# Visit https://api.census.gov/data/key_signup.html to
# get your API key.

# census_api_key("PasteYourAPIKeyBetweenTheseQuoteMarks")

# ============================================================
# 2. LOAD ACS CODEBOOKS
# ============================================================

DetailedTables <- load_variables(2023, "acs5", cache = TRUE)
SubjectTables  <- load_variables(2023, "acs5/subject", cache = TRUE)
ProfileTables  <- load_variables(2023, "acs5/profile", cache = TRUE)

# Three variables from ProfileTables to try:
# DP03_0074P, DP03_0074, SNAP households, last 12 months.
# DP04_0142P, DP04_0142, Renter households with GRAPI > 35%
# DP03_0108P, DP03_0108, Workers 19-64 no health insurance

# ============================================================
# 3. DEFINE VARIABLES OF INTEREST
# ============================================================

VariableList =
  c(
    Percent_     = "DP03_0074P",
    # % HH receiving SNAP
    Households_  = "DP03_0074"
  )    # Total households

# ============================================================
# 4. FETCH COUNTY SUBDIVISION DATA (TENNESSEE)
# ============================================================

mydata <- get_acs(
  geography = "county subdivision",
  state = "TN",
  variables = VariableList,
  year = 2023,
  survey = "acs5",
  output = "wide",
  geometry = TRUE
)

# ============================================================
# 5. CLEAN AND REFORMAT GEOGRAPHIC NAMES
# ============================================================

mydata <- separate_wider_delim(mydata,
                               NAME,
                               delim  = ", ",
                               names  = c("Division", "County", "State"))

# ============================================================
# 6. FILTER FOR A SINGLE COUNTY
# ============================================================

filtereddata <- mydata %>%
  filter(County %in% c("Rutherford County"))

# ============================================================
# 7. PLOT ESTIMATES WITH ERROR BARS
# ============================================================

mygraph <- plot_ly(
  data = filtereddata,
  x = ~Percent_E,
  y = ~reorder(Division, Percent_E),
  type = 'scatter',
  mode = 'markers',
  error_x = list(
    type = "data",
    array = ~Percent_M,
    visible = TRUE
  ),
  marker = list(color = "#099d91", size = 10)
) %>%
  layout(
    title = "Estimates by Area (Interactive)",
    xaxis = list(title = "2019–2023 ACS Estimate"),
    yaxis = list(title = "", automargin = TRUE)
  )

mygraph

# ============================================================
# 8. MAP DATA FOR RUTHERFORD COUNTY SUBDIVISIONS
# ============================================================

mapdata <- filtereddata %>%
  rename(Percent   = Percent_E,
         Range      = Percent_M,
         Households = Households_E) %>%
  st_as_sf()

mapviewOptions(basemaps.color.shuffle = FALSE)

DivisionMap <- mapview(
  mapdata,
  zcol = "Percent",
  layer.name = "Percent",
  popup = popupTable(
    mapdata,
    feature.id   = FALSE,
    row.numbers  = FALSE,
    zcol = c("State", "County", "Division", "Percent", "Range", "Households")
  )
)

DivisionMap

# ============================================================
# 9. FILTER DATA FOR MULTI-COUNTY REGION
# ============================================================

filtereddata2 <- mydata %>%
  filter(
    County %in% c(
      "Rutherford County",
      "Davidson County",
      "Williamson County",
      "Cheatham County",
      "Robertson County",
      "Sumner County",
      "Wilson County"
    )
  )

# ============================================================
# 10. MAP MULTI-COUNTY AREA
# ============================================================

mapdata2 <- filtereddata2 %>%
  rename(Percent   = Percent_E,
         Range      = Percent_M,
         Households = Households_E) %>%
  st_as_sf()

# County boundaries
Counties <- get_acs(
  geography = "county",
  state = "TN",
  county = c(
    "Rutherford",
    "Davidson",
    "Williamson",
    "Robertson",
    "Cheatham",
    "Sumner",
    "Wilson"
  ),
  variables = VariableList,
  year = 2023,
  survey = "acs5",
  output = "wide",
  geometry = TRUE
)

mapviewOptions(basemaps.color.shuffle = FALSE)

DivisionMap2 <- mapview(
  Counties,
  zcol         = NULL,
  legend       = FALSE,
  col.regions  = "transparent",
  alpha.regions = 0,
  lwd          = 1.5,
  color        = "black"
) + mapview(
  mapdata2,
  zcol = "Percent",
  layer.name = "Percent",
  popup = popupTable(
    mapdata2,
    # <-- fixed: use mapdata2 here
    feature.id   = FALSE,
    row.numbers  = FALSE,
    zcol = c("State", "County", "Division", "Percent", "Range", "Households")
  )
)

DivisionMap2

# ============================================================
# 11. MAP ENTIRE STATE
# ============================================================

filtereddata3 <- mydata

mapdata3 <- filtereddata3 %>%
  rename(Percent   = Percent_E,
         Range      = Percent_M,
         Households = Households_E) %>%
  st_as_sf()

mapviewOptions(basemaps.color.shuffle = FALSE)

DivisionMap3 <- mapview(
  mapdata3,
  zcol = "Percent",
  layer.name = "Percent",
  popup = popupTable(
    mapdata3,
    # <-- fixed: use mapdata3 here
    feature.id   = FALSE,
    row.numbers  = FALSE,
    zcol = c("State", "County", "Division", "Percent", "Range", "Households")
  )
)

DivisionMap3

# ============================================================
# 12. COUNTY-LEVEL TABLE FOR SELECTED COUNTIES
# ============================================================

# Fetch all Tennessee county-level data
CountyLevelData <- get_acs(
  geography = "county",
  state = "TN",
  variables = VariableList,
  year = 2023,
  survey = "acs5",
  output = "wide",
  geometry = FALSE
)

# Filter for the counties in the DivisionMap2 map
SelectedCounties <- CountyLevelData %>% 
  filter(NAME %in% c("Rutherford County, Tennessee",
                     "Davidson County, Tennessee",
                     "Williamson County, Tennessee",
                     "Cheatham County, Tennessee",
                     "Robertson County, Tennessee",
                     "Sumner County, Tennessee",
                     "Wilson County, Tennessee")) %>%
  select(NAME, Percent_E, Percent_M, Households_E) %>%
  rename(
    County     = NAME,
    Percent    = Percent_E,
    Range      = Percent_M,
    Households = Households_E
  ) %>%
  arrange(desc(Percent))

# Create formatted table
CountyTable <- SelectedCounties %>%
  gt() %>%
  gt_theme_espn() %>%           # clean theme
  cols_label(
    Percent    = "Percent (%)",
    Range      = "Margin of Error",
    Households = "Households"
  ) %>%
  fmt_number(
    columns = c(Percent, Range),
    decimals = 1
  ) %>%
  fmt_number(
    columns = c(Households),
    decimals = 0,
    use_seps = TRUE
  ) %>%
  tab_header(
    title = "Household-Level Estimates by County",
    subtitle = "Nashville-Area Counties (2019–2023 ACS 5-Year Estimates)"
  )

# Display the table
CountyTable