This analysis explores the NOAA Storm Database to determine which weather events are most harmful to population health and which have the greatest economic consequences. The dataset spans from 1950 to 2011. Population health impact is measured using fatalities and injuries, while economic consequences are measured using property and crop damage. The analysis identifies the most severe event types in both categories. These results help highlight which events require greater preparedness and resource allocation.
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.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
data <- read.csv("repdata_data_StormData.csv.bz2")
health_data <- data %>%
group_by(EVTYPE) %>%
summarise(total_health = sum(FATALITIES + INJURIES, na.rm = TRUE)) %>%
arrange(desc(total_health))
convert_exp <- function(exp) {
if (exp == "K") return(1e3)
else if (exp == "M") return(1e6)
else if (exp == "B") return(1e9)
else return(1)
}
data$PROPDMGEXP <- sapply(data$PROPDMGEXP, convert_exp)
data$CROPDMGEXP <- sapply(data$CROPDMGEXP, convert_exp)
data$PROPDMG_TOTAL <- data$PROPDMG * data$PROPDMGEXP
data$CROPDMG_TOTAL <- data$CROPDMG * data$CROPDMGEXP
econ_data <- data %>%
group_by(EVTYPE) %>%
summarise(total_damage = sum(PROPDMG_TOTAL + CROPDMG_TOTAL, na.rm = TRUE)) %>%
arrange(desc(total_damage))
top_health <- head(health_data, 10)
barplot(top_health$total_health,
names.arg = top_health$EVTYPE,
las = 2,
col = "red",
main = "Top 10 Most Harmful Events to Population Health",
ylab = "Fatalities and Injuries")
The plot shows that tornadoes are the most harmful events in terms of population health, followed by excessive heat and floods.
top_econ <- head(econ_data, 10)
barplot(top_econ$total_damage,
names.arg = top_econ$EVTYPE,
las = 2,
col = "blue",
main = "Top 10 Events with Greatest Economic Consequences",
ylab = "Total Damage (USD)")
The plot indicates that floods, hurricanes, and storm surges contribute the most to economic damage.