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:
Downloading the latest Tennessee state data sheet from the archive at UnitedForAlice.org.
Filtering the data for subcounty areas within Rutherford County.
Merging the filtered data with the latest county subdivision map from the U.S. Census Bureau.
Adding, within each subdivision, the number of households deemed “Poverty households” according the the U.S. federal poverty level and the number of households deemed “ALICE households” according to ALICE criteria, then dividing the sum by the subdivision’s total number of households.
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:
A user-selectable set of base maps showing roads and geographic features. These features make determining the location of each mapped area easier for the map user.
The ability to zoom and pan. This feature allows map users to explore the map with greater precision.
Below is an example map, followed by the code that produced it.
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)
Ken Blake
School of Journalism and Strategic Media
Middle Tennessee State University
ken.blake@mtsu.edu