This report analyzes data from the U.S. NOAA Storm Database to identify the most harmful weather events according to population health and economic impact. Tornadoes are shown to be the leading cause of injuries and fatalities, while floods and hurricanes contribute to the greatest economic damage.
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(data.table)
## Warning: package 'data.table' was built under R version 4.4.3
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
##
## between, first, last
storm <- read.csv("repdata_data_StormData.csv")
storm <- as.data.table(storm)
storm_data <- storm[, .(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)]
convert_exp <- function(exp) {
exp <- toupper(exp)
ifelse(exp == "K", 1e3,
ifelse(exp == "M", 1e6,
ifelse(exp == "B", 1e9, 1)))
}
storm_data[, PROPDMGVAL := PROPDMG * convert_exp(PROPDMGEXP)]
storm_data[, CROPDMGVAL := CROPDMG * convert_exp(CROPDMGEXP)]
storm_data[, TOTALDMG := PROPDMGVAL + CROPDMGVAL]
health_impact <- storm_data[, .(Fatalities = sum(FATALITIES),
Injuries = sum(INJURIES)),
by = EVTYPE][order(-Fatalities - Injuries)]
top_health <- head(health_impact, 10)
top_health
## EVTYPE Fatalities Injuries
## <char> <num> <num>
## 1: TORNADO 5633 91346
## 2: EXCESSIVE HEAT 1903 6525
## 3: TSTM WIND 504 6957
## 4: FLOOD 470 6789
## 5: LIGHTNING 816 5230
## 6: HEAT 937 2100
## 7: FLASH FLOOD 978 1777
## 8: ICE STORM 89 1975
## 9: THUNDERSTORM WIND 133 1488
## 10: WINTER STORM 206 1321
ggplot(top_health, aes(reorder(EVTYPE, -(Fatalities + Injuries)), Injuries + Fatalities)) +
geom_bar(stat = "identity", fill = "tomato") +
labs(title = "Top 10 Most Harmful Events to Population Health",
x = "Event Type", y = "Total Casualties (Fatalities + Injuries)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
econ_impact <- storm_data[, .(Total_Damage = sum(TOTALDMG, na.rm = TRUE)),
by = EVTYPE][order(-Total_Damage)]
top_econ <- head(econ_impact, 10)
top_econ
## EVTYPE Total_Damage
## <char> <num>
## 1: FLOOD 150319678257
## 2: HURRICANE/TYPHOON 71913712800
## 3: TORNADO 57352114049
## 4: STORM SURGE 43323541000
## 5: HAIL 18758221521
## 6: FLASH FLOOD 17562129167
## 7: DROUGHT 15018672000
## 8: HURRICANE 14610229010
## 9: RIVER FLOOD 10148404500
## 10: ICE STORM 8967041360
ggplot(top_econ, aes(reorder(EVTYPE, -Total_Damage), Total_Damage / 1e9)) +
geom_bar(stat = "identity", fill = "steelblue") +
labs(title = "Top 10 Events with Greatest Economic Impact",
x = "Event Type", y = "Total Damage (Billion USD)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
## Conclusion Tornadoes appear to be the most harmful weather event to
public health, while floods and hurricanes cause the most significant
economic damages.