This analysis explores the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database, which tracks major weather events across the United States from 1950 to 2011. The goal is to identify which event types are most harmful to population health and which have the greatest economic consequences. Total fatalities and injuries are aggregated by event type to assess health impact, while property and crop damage are combined to assess economic impact. The analysis shows that tornadoes cause the greatest harm to population health, while floods and hurricanes cause the most economic damage.
storm <- read.csv("repdata_data_StormData.csv.bz2")
dim(storm)
## [1] 902297 37
# Aggregate fatalities and injuries by event type
fatalities <- aggregate(FATALITIES ~ EVTYPE, data = storm, FUN = sum)
injuries <- aggregate(INJURIES ~ EVTYPE, data = storm, FUN = sum)
# Merge and calculate total harm
health <- merge(fatalities, injuries, by = "EVTYPE")
health$total <- health$FATALITIES + health$INJURIES
# Sort by total harm, take top 10
top_health <- health[order(-health$total), ][1:10, ]
top_health
## EVTYPE FATALITIES INJURIES total
## 834 TORNADO 5633 91346 96979
## 130 EXCESSIVE HEAT 1903 6525 8428
## 856 TSTM WIND 504 6957 7461
## 170 FLOOD 470 6789 7259
## 464 LIGHTNING 816 5230 6046
## 275 HEAT 937 2100 3037
## 153 FLASH FLOOD 978 1777 2755
## 427 ICE STORM 89 1975 2064
## 760 THUNDERSTORM WIND 133 1488 1621
## 972 WINTER STORM 206 1321 1527
# Function to convert damage exponents to numeric multipliers
convert_damage <- function(value, exp) {
ifelse(exp == "K", value * 1000,
ifelse(exp == "M", value * 1e6,
ifelse(exp == "B", value * 1e9, value)))
}
# Apply conversion to property and crop damage
storm$prop_damage <- convert_damage(storm$PROPDMG, storm$PROPDMGEXP)
storm$crop_damage <- convert_damage(storm$CROPDMG, storm$CROPDMGEXP)
# Aggregate by event type
prop <- aggregate(prop_damage ~ EVTYPE, data = storm, FUN = sum)
crop <- aggregate(crop_damage ~ EVTYPE, data = storm, FUN = sum)
# Merge and calculate total damage
econ <- merge(prop, crop, by = "EVTYPE")
econ$total_damage <- econ$prop_damage + econ$crop_damage
# Sort by total damage, take top 10
top_econ <- econ[order(-econ$total_damage), ][1:10, ]
top_econ
## EVTYPE prop_damage crop_damage total_damage
## 170 FLOOD 144657709807 5661968450 150319678257
## 411 HURRICANE/TYPHOON 69305840000 2607872800 71913712800
## 834 TORNADO 56925660790 414953270 57340614060
## 670 STORM SURGE 43323536000 5000 43323541000
## 244 HAIL 15727367053 3025537890 18752904943
## 153 FLASH FLOOD 16140812067 1421317100 17562129167
## 95 DROUGHT 1046106000 13972566000 15018672000
## 402 HURRICANE 11868319010 2741910000 14610229010
## 590 RIVER FLOOD 5118945500 5029459000 10148404500
## 427 ICE STORM 3944927860 5022113500 8967041360
par(mar = c(8, 4, 4, 2))
barplot(top_health$total,
names.arg = top_health$EVTYPE,
las = 2,
col = "red",
main = "Top 10 Weather Events Harmful to Health",
ylab = "Total Fatalities + Injuries")
par(mar = c(8, 4, 4, 2))
barplot(top_econ$total_damage / 1e9,
names.arg = top_econ$EVTYPE,
las = 2,
col = "blue",
main = "Top 10 Weather Events by Economic Damage",
ylab = "Total Damage (billions USD)")