This analysis explores the NOAA Storm Database to identify which types of weather events are most harmful to population health and which have the greatest economic consequences. The dataset includes information on fatalities, injuries, and property and crop damage. Data processing involved selecting relevant variables and converting damage values into numeric form. The results show that tornadoes are the most harmful to population health, while floods and hurricanes cause the greatest economic damage.
library(dplyr)
##
## 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
data <- read.csv("repdata_data_StormData.csv.bz2")
data <- data[, c("EVTYPE", "FATALITIES", "INJURIES",
"PROPDMG", "PROPDMGEXP",
"CROPDMG", "CROPDMGEXP")]
convert_exp <- function(exp) {
ifelse(exp == "K", 1e3,
ifelse(exp == "M", 1e6,
ifelse(exp == "B", 1e9, 1)))
}
data$PROPDMGVAL <- data$PROPDMG * convert_exp(data$PROPDMGEXP)
data$CROPDMGVAL <- data$CROPDMG * convert_exp(data$CROPDMGEXP)
health <- data %>%
group_by(EVTYPE) %>%
summarise(FATALITIES = sum(FATALITIES),
INJURIES = sum(INJURIES))
health <- mutate(health, TOTAL = FATALITIES + INJURIES)
health <- arrange(health, desc(TOTAL))
top_health <- head(health, 10)
top_health
## # A tibble: 10 × 4
## EVTYPE FATALITIES INJURIES TOTAL
## <chr> <dbl> <dbl> <dbl>
## 1 TORNADO 5633 91346 96979
## 2 EXCESSIVE HEAT 1903 6525 8428
## 3 TSTM WIND 504 6957 7461
## 4 FLOOD 470 6789 7259
## 5 LIGHTNING 816 5230 6046
## 6 HEAT 937 2100 3037
## 7 FLASH FLOOD 978 1777 2755
## 8 ICE STORM 89 1975 2064
## 9 THUNDERSTORM WIND 133 1488 1621
## 10 WINTER STORM 206 1321 1527
par(mar = c(10, 7, 4, 2)) # increase LEFT margin (7)
barplot(top_health$TOTAL,
names.arg = top_health$EVTYPE,
las = 2,
col = "red",
main = "Top Events Harmful to Population Health",
ylab = "Fatalities + Injuries",
cex.names = 0.7,
cex.lab = 1.2) # makes y-label clearer
Figure 1: This plot shows the top 10 weather events that are most harmful to population health, measured by total fatalities and injuries. Tornadoes clearly have the highest impact compared to other event types.
econ <- data %>%
group_by(EVTYPE) %>%
summarise(PROP = sum(PROPDMGVAL),
CROP = sum(CROPDMGVAL))
econ <- mutate(econ, TOTAL = PROP + CROP)
econ <- arrange(econ, desc(TOTAL))
top_econ <- head(econ, 10)
top_econ
## # A tibble: 10 × 4
## EVTYPE PROP CROP TOTAL
## <chr> <dbl> <dbl> <dbl>
## 1 FLOOD 144657709807 5661968450 150319678257
## 2 HURRICANE/TYPHOON 69305840000 2607872800 71913712800
## 3 TORNADO 56925660790. 414953270 57340614060.
## 4 STORM SURGE 43323536000 5000 43323541000
## 5 HAIL 15727367053. 3025537890 18752904943.
## 6 FLASH FLOOD 16140812067. 1421317100 17562129167.
## 7 DROUGHT 1046106000 13972566000 15018672000
## 8 HURRICANE 11868319010 2741910000 14610229010
## 9 RIVER FLOOD 5118945500 5029459000 10148404500
## 10 ICE STORM 3944927860 5022113500 8967041360
par(mar = c(10, 7, 4, 2))
barplot(top_econ$TOTAL,
names.arg = top_econ$EVTYPE,
las = 2,
col = "blue",
main = "Top Events with Economic Damage",
ylab = "Damage (USD)",
cex.names = 0.7,
cex.lab = 1.2)
Figure 2: This plot shows the top 10 weather events with the greatest economic consequences, measured by total property and crop damage. Floods clearly cause the highest economic damage, followed by hurricane/typhoon events. This indicates that large-scale water-related disasters have the most significant financial impact.