This report analyzes data from the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database to identify the types of events most harmful to population health and those with the greatest economic consequences. The data include records of major weather events from 1950 to 2011. We examine the number of injuries and fatalities to assess health impact and property and crop damage to assess economic impact. Our analysis highlights the top contributors to damage and can help guide emergency preparedness efforts.
# Load necessary libraries
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)
## Warning: package 'ggplot2' was built under R version 4.4.3
# Load data
storm_data <- read.csv("repdata_data_StormData.csv")
# Keep only relevant columns
storm <- storm_data %>%
select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)
# Group and summarize by event type
health_impact <- storm %>%
group_by(EVTYPE) %>%
summarize(fatalities = sum(FATALITIES, na.rm=TRUE),
injuries = sum(INJURIES, na.rm=TRUE)) %>%
arrange(desc(fatalities + injuries))
# Top 10 events
top_health <- health_impact[1:10, ]
# Plot
ggplot(top_health, aes(reorder(EVTYPE, -(fatalities + injuries)), fatalities + injuries)) +
geom_bar(stat="identity", fill="tomato") +
coord_flip() +
labs(title="Top 10 Most Harmful Events to Population Health",
x="Event Type", y="Total Fatalities + Injuries")
# Helper function to convert exponents
convert_exp <- function(exp) {
ifelse(exp %in% c("K", "k"), 1e3,
ifelse(exp %in% c("M", "m"), 1e6,
ifelse(exp %in% c("B", "b"), 1e9, 1)))
}
# Apply conversions
storm$PROPDMGEXP <- convert_exp(storm$PROPDMGEXP)
storm$CROPDMGEXP <- convert_exp(storm$CROPDMGEXP)
# Compute total damage
storm$prop_dmg <- storm$PROPDMG * storm$PROPDMGEXP
storm$crop_dmg <- storm$CROPDMG * storm$CROPDMGEXP
storm$total_dmg <- storm$prop_dmg + storm$crop_dmg
# Group by event type
econ_impact <- storm %>%
group_by(EVTYPE) %>%
summarize(total_damage = sum(total_dmg, na.rm=TRUE)) %>%
arrange(desc(total_damage))
# Top 10 economic damage events
top_econ <- econ_impact[1:10, ]
# Plot
ggplot(top_econ, aes(reorder(EVTYPE, -total_damage), total_damage)) +
geom_bar(stat="identity", fill="steelblue") +
coord_flip() +
labs(title="Top 10 Events with Greatest Economic Consequences",
x="Event Type", y="Total Property + Crop Damage ($)")
The analysis reveals that tornadoes are the most harmful weather event to population health in terms of injuries and fatalities. On the economic side, floods and hurricanes cause the most significant property and crop damages. These insights can help prioritize emergency management strategies and resource allocation for disaster preparedness.