This R script interactively maps the percentage of “economically distressed” households within each Rutherford County, Tennessee, subcounty area.

It produces the percentages shown on the map by:

The script can easily be adjusted to map cities or ZIP codes and to do so for counties, or combinations of counties, other than Rutherford. It also can be adjusted to map poverty and ALICE household percentagtes or counts separately, rather than combined.

Much of the map’s information duplicates information in the maps available on UnitedForAlice.org. The map produced here, though, offers two additional features:

Below is an example map, followed by the code that produced it.

Code:

if (!require("tidyverse")) install.packages("tidyverse")
if (!require("tidycensus")) install.packages("tidycensus")
if (!require("sf")) install.packages("sf")
if (!require("mapview")) install.packages("mapview")

library(tidyverse)
library(tidycensus)
library(sf)
library(mapview)
library(readxl)

# Download ALICE data and format column headings

download.file("https://www.unitedforalice.org/Attachments/StateDataSheet/DataSheet_TN.xlsx",
              "DataSheet_TN.xlsx", quiet = TRUE, mode = "wb")

Alice <- read_xlsx("DataSheet_TN.xlsx", sheet="Subcounty, Places, Zip Codes")
names(Alice) <- names(Alice) %>% make.names()

#Filter for Rutherford County subdivision data

Alice_sub <- Alice %>%
  filter(Geography.type == "Sub_County")
Alice_sub <-
  separate_wider_delim(Alice_sub,
                       GEO.display_label,
                       delim = ", ",
                       names = c("District", "County", "State"))
Alice_sub_RUCO <- Alice_sub %>% 
  filter(County == "Rutherford County")

# Get subdivision map and households estimate

VariableList = 
  c(Population_ = "B01001_001")

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

# Merging data

RCMap <- left_join(Alice_sub_RUCO,
                    Map_sub,
                    by = join_by(GEO.id2 == GEOID))
RCMap <- RCMap %>%
  mutate(Distressed = (Poverty.Households + ALICE.Households)/Households)
RCMap <- RCMap %>%
  mutate(Distressed = round(Distressed,2))

RCMap <- st_as_sf(RCMap)

mapviewOptions(basemaps.color.shuffle = FALSE)

mapview(RCMap, zcol = "Distressed",
        layer.name = "% Distressed",
        popup = F)

Contact:

Ken Blake
School of Journalism and Strategic Media
Middle Tennessee State University
ken.blake@mtsu.edu