Carcinogens are things capable of causing cancer, and the U.S. Environmental Protection Agency tracks and reports releases of carcinogens annually at various industrial sites around the country. Here is an interactive map of the most recent year’s reported carcinogen releases in Tennessee.
The map presents data extracted from the latest Toxics Release Inventory published by the EPA. This R script retrieves, cleans and maps the data:
#Installing and loading packages R needs for this analysis
if (!require("tidyverse"))
install.packages("tidyverse")
if (!require("leaflet"))
install.packages("leaflet")
library(tidyverse)
library(leaflet)
# Getting the data
tri = read.csv("https://data.epa.gov/efservice/downloads/tri/mv_tri_basic_download/2023_TN/csv", as.is=T)
# names(tri)
names(tri) = gsub("X\\d+\\.\\.", "", names(tri))
names(tri) = gsub("[0-9\\d\\.ABCD]+\\.\\.\\.", "", names(tri))
# names(tri)
tri <- subset(tri,select=c(FACILITY.NAME,
CITY,
LATITUDE,
LONGITUDE,
CHEMICAL,
CARCINOGEN,
FUGITIVE.AIR,
STACK.AIR,
WATER,
UNIT.OF.MEASURE))
options(scipen=999)
#Grams to pounds
multiplier = ifelse(tri$UNIT.OF.MEASURE == "Grams", 1 / 453.592, 1)
tri$FUGITIVE.AIR = multiplier * tri$FUGITIVE.AIR
tri$STACK.AIR = multiplier * tri$STACK.AIR
tri$WATER = multiplier * tri$WATER
tri$UNIT.OF.MEASURE = "Pounds"
#Summing
tri$FUGITIVE.AIR[is.na(tri$FUGITIVE.AIR)] = 0
tri$STACK.AIR[is.na(tri$STACK.AIR)] = 0
tri$WATER[is.na(tri$WATER)] = 0
tri$TOTAL.POUNDS = tri$FUGITIVE.AIR + tri$STACK.AIR + tri$WATER
tri$CARCINOGEN.POUNDS = ifelse(tri$CARCINOGEN == "YES", tri$TOTAL.POUNDS, 0)
#Filtering and mapping data
data <- tri
data <- filter(data,CARCINOGEN.POUNDS > 0)
data$popup <- paste("<b>Facility name: #: </b>", data$FACILITY.NAME,
"<br>", "<b>City: </b>", data$CITY,
"<br>", "<b>Carcinogen: </b>", data$CHEMICAL,
"<br>", "<b>Fugitive air: </b>", data$FUGITIVE.AIR,
"<br>", "<b>Stack air: </b>", data$STACK.AIR,
"<br>", "<b>Water: </b>", data$WATER,
"<br>", "<b>Total pounds: </b>", data$CARCINOGEN.POUNDS)
data$LATITUDE <- as.numeric(data$LATITUDE)
data$LONGITUDE <- as.numeric(data$LONGITUDE)
TheMap <- leaflet(data, width = "100%") %>% addTiles() %>%
addTiles(group = "OSM (default)") %>%
addProviderTiles(provider = "Esri.WorldStreetMap",group = "World StreetMap") %>%
addProviderTiles(provider = "Esri.WorldImagery",group = "World Imagery") %>%
addMarkers(lng = ~LONGITUDE, lat = ~LATITUDE, popup = data$popup, clusterOptions = markerClusterOptions()) %>%
addLayersControl(
baseGroups = c("OSM (default)","World StreetMap", "World Imagery"),
options = layersControlOptions(collapsed = FALSE)
)