This report explores the U.S. NOAA Storm Database, which records major storms and weather events from 1950 to November 2011, to find out which event types cause the most harm. The raw data file is loaded and processed entirely inside this document. Health impact is measured by total fatalities and injuries, and economic impact by total property and crop damage after converting the damage exponent codes into dollar amounts. The many original EVTYPE labels are consolidated into a smaller set of standard event categories because of inconsistent spelling and naming. Tornadoes are by far the most harmful event type for population health, followed by excessive heat, thunderstorm winds, floods and lightning. Floods, hurricanes/typhoons, tornadoes and storm surge produce the largest property and crop damage, while drought is the leading source of crop damage specifically. The results are summarised in two tables and two figures.
The analysis starts from the raw CSV file. If the local file is missing, the original compressed file is downloaded. The chunk is cached because reading the file is slow.
file <- "repdata_data_StormData1.csv"
if (!file.exists(file)) {
url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
download.file(url, destfile = "StormData.csv.bz2", mode = "wb")
file <- "StormData.csv.bz2"
}
storm_raw <- read.csv(file, stringsAsFactors = FALSE)
dim(storm_raw)
## [1] 902297 37
Only the event type, the population health variables (FATALITIES, INJURIES) and the economic variables (PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP) are needed.
library(dplyr)
library(ggplot2)
library(tidyr)
storm <- storm_raw %>%
select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)
PROPDMG and CROPDMG hold a number, and the matching *EXP column holds a letter giving its magnitude (H = hundreds, K = thousands, M = millions, B = billions). Digits 0-8 are treated as powers of ten. Blank or unknown symbols ("", +, -, ?) get a multiplier of 1, since they are rare and cannot be interpreted reliably.
exp_to_multiplier <- function(x) {
x <- toupper(trimws(x))
mult <- rep(1, length(x))
mult[x == "H"] <- 1e2
mult[x == "K"] <- 1e3
mult[x == "M"] <- 1e6
mult[x == "B"] <- 1e9
digits <- x %in% as.character(0:8)
mult[digits] <- 10^as.numeric(x[digits])
mult
}
storm <- storm %>%
mutate(PROP_USD = PROPDMG * exp_to_multiplier(PROPDMGEXP),
CROP_USD = CROPDMG * exp_to_multiplier(CROPDMGEXP),
TOTAL_USD = PROP_USD + CROP_USD,
HEALTH = FATALITIES + INJURIES)
The EVTYPE variable contains hundreds of labels with different spellings and abbreviations (for example TSTM WIND, THUNDERSTORM WINDS). Labels are converted to upper case, trimmed, and grouped into broader categories using pattern matching. Rules are applied in order, so the first match wins. Without this step, damage for the same phenomenon would be split across many labels and rankings would be misleading.
clean_event <- function(x) {
x <- toupper(trimws(x))
out <- x
rules <- list(
"HURRICANE/TYPHOON" = "HURRICANE|TYPHOON",
"STORM SURGE" = "STORM SURGE|COASTAL FLOOD|TIDAL FLOOD",
"TORNADO" = "TORNADO|FUNNEL|WATERSPOUT",
"FLASH FLOOD" = "FLASH FLOOD",
"FLOOD" = "FLOOD|RIVER FLOOD|URBAN/SML STREAM",
"TROPICAL STORM" = "TROPICAL STORM",
"THUNDERSTORM WIND" = "THUNDERSTORM|TSTM",
"LIGHTNING" = "LIGHTNING",
"HAIL" = "HAIL",
"EXCESSIVE HEAT" = "EXCESSIVE HEAT|EXTREME HEAT|HEAT|RECORD HIGH|UNSEASONABLY WARM",
"EXTREME COLD/WIND CHILL" = "EXTREME COLD|WIND CHILL|EXTREME WINDCHILL|RECORD COLD|HYPOTHERMIA",
"WINTER STORM" = "WINTER STORM|WINTER WEATHER|BLIZZARD|HEAVY SNOW|SNOW|ICE STORM|SLEET|FREEZING RAIN|ICE",
"FROST/FREEZE" = "FROST|FREEZE",
"WILDFIRE" = "WILDFIRE|WILD/FOREST FIRE|FOREST FIRE|GRASS FIRE|BRUSH FIRE",
"DROUGHT" = "DROUGHT",
"HIGH WIND" = "HIGH WIND|STRONG WIND|WIND",
"RIP CURRENT" = "RIP CURRENT",
"HEAVY RAIN" = "HEAVY RAIN|RAIN",
"DENSE FOG" = "FOG",
"AVALANCHE" = "AVALANCHE|AVALANCE",
"LANDSLIDE" = "LANDSLIDE|MUDSLIDE|LAND SLIDE|MUD SLIDE",
"HIGH SURF" = "HIGH SURF|HEAVY SURF|ROUGH SURF"
)
done <- rep(FALSE, length(x))
for (nm in names(rules)) {
hit <- !done & grepl(rules[[nm]], x)
out[hit] <- nm
done <- done | hit
}
out
}
storm$EVENT <- clean_event(storm$EVTYPE)
c(original_labels = length(unique(toupper(trimws(storm$EVTYPE)))),
cleaned_labels = length(unique(storm$EVENT)))
## original_labels cleaned_labels
## 890 271
health <- storm %>%
group_by(EVENT) %>%
summarise(Fatalities = sum(FATALITIES),
Injuries = sum(INJURIES),
Total = sum(HEALTH),
.groups = "drop") %>%
arrange(desc(Total))
econ <- storm %>%
group_by(EVENT) %>%
summarise(Property_Billion = sum(PROP_USD) / 1e9,
Crop_Billion = sum(CROP_USD) / 1e9,
Total_Billion = sum(TOTAL_USD) / 1e9,
.groups = "drop") %>%
arrange(desc(Total_Billion))
top_health <- head(health, 10)
knitr::kable(top_health, format.args = list(big.mark = ","),
caption = "Top 10 event types by total fatalities and injuries, 1950-2011.")
| EVENT | Fatalities | Injuries | Total |
|---|---|---|---|
| TORNADO | 5,664 | 91,439 | 97,103 |
| EXCESSIVE HEAT | 3,178 | 9,241 | 12,419 |
| THUNDERSTORM WIND | 729 | 9,544 | 10,273 |
| FLOOD | 512 | 6,873 | 7,385 |
| WINTER STORM | 654 | 6,037 | 6,691 |
| LIGHTNING | 817 | 5,231 | 6,048 |
| FLASH FLOOD | 1,035 | 1,802 | 2,837 |
| HIGH WIND | 453 | 1,895 | 2,348 |
| WILDFIRE | 87 | 1,458 | 1,545 |
| HURRICANE/TYPHOON | 135 | 1,333 | 1,468 |
health_long <- top_health %>%
select(EVENT, Fatalities, Injuries) %>%
pivot_longer(c(Fatalities, Injuries), names_to = "Type", values_to = "Count")
ggplot(health_long, aes(x = reorder(EVENT, Count, sum), y = Count, fill = Type)) +
geom_col() +
coord_flip() +
scale_y_continuous(labels = scales::comma) +
labs(x = NULL, y = "Number of people affected",
title = "Most harmful event types for population health",
fill = NULL) +
theme_minimal()
Figure 1: Total fatalities and injuries caused by the ten most harmful event types in the U.S. (1950-2011). Bars are stacked by fatalities and injuries and ordered by their combined total.
Tornadoes cause by far the most harm to population health, with far more combined fatalities and injuries than any other event. Excessive heat, thunderstorm winds, floods and lightning follow.
top_econ <- head(econ, 10)
knitr::kable(top_econ, digits = 2, format.args = list(big.mark = ","),
caption = "Top 10 event types by total property and crop damage (billions of USD), 1950-2011.")
| EVENT | Property_Billion | Crop_Billion | Total_Billion |
|---|---|---|---|
| FLOOD | 150.26 | 10.86 | 161.12 |
| HURRICANE/TYPHOON | 85.36 | 5.52 | 90.87 |
| TORNADO | 58.61 | 0.42 | 59.03 |
| STORM SURGE | 48.38 | 0.00 | 48.38 |
| FLASH FLOOD | 17.59 | 1.53 | 19.12 |
| HAIL | 15.98 | 3.05 | 19.02 |
| WINTER STORM | 12.43 | 5.32 | 17.75 |
| DROUGHT | 1.05 | 13.97 | 15.02 |
| THUNDERSTORM WIND | 11.18 | 1.27 | 12.46 |
| TROPICAL STORM | 7.71 | 0.69 | 8.41 |
econ_long <- top_econ %>%
select(EVENT, Property_Billion, Crop_Billion) %>%
pivot_longer(c(Property_Billion, Crop_Billion), names_to = "Type", values_to = "Damage") %>%
mutate(Type = recode(Type, Property_Billion = "Property", Crop_Billion = "Crop"))
ggplot(econ_long, aes(x = reorder(EVENT, Damage, sum), y = Damage, fill = Type)) +
geom_col() +
coord_flip() +
labs(x = NULL, y = "Damage (billion USD)",
title = "Event types with the greatest economic consequences",
fill = NULL) +
theme_minimal()
Figure 2: Total property and crop damage (billions of US dollars, not inflation adjusted) for the ten most economically damaging event types in the U.S. (1950-2011). Bars are stacked by damage type and ordered by combined total.
Floods, hurricanes/typhoons, tornadoes and storm surge account for the largest total damage, most of it property damage. Drought stands out because its damage is almost entirely to crops.