This report analyzes the U.S. National Oceanic and Atmospheric Administration’s (NOAA) Storm Database to determine which types of severe weather events are most harmful to public health and which cause the greatest economic damage. Data from 1950 to November 2011 are examined, with focus on total fatalities, injuries, and property/crop damages across event types. Tornadoes are identified as the most harmful to population health, while floods and hurricanes cause the most economic losses. This information can be useful for government agencies to better prepare for and mitigate the impacts of severe weather.
# Load required packages
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
library(readr)
## Warning: package 'readr' was built under R version 4.4.3
library(knitr)
## Warning: package 'knitr' was built under R version 4.4.3
# Load the dataset
data <- read.csv("repdata_data_StormData.csv.bz2")
# Select relevant columns
storm_data <- data %>%
select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)
# Function to convert exponent values
exp_convert <- function(exp) {
exp <- toupper(as.character(exp))
ifelse(exp == "H", 1e2,
ifelse(exp == "K", 1e3,
ifelse(exp == "M", 1e6,
ifelse(exp == "B", 1e9, 1))))
}
# Convert exponents and calculate total damage
storm_data <- storm_data %>%
mutate(PROPDMGEXP = exp_convert(PROPDMGEXP),
CROPDMGEXP = exp_convert(CROPDMGEXP),
PROPDMGVAL = PROPDMG * PROPDMGEXP,
CROPDMGVAL = CROPDMG * CROPDMGEXP)
# Summarize total injuries and fatalities by event type
health_impact <- storm_data %>%
group_by(EVTYPE) %>%
summarise(Fatalities = sum(FATALITIES, na.rm = TRUE),
Injuries = sum(INJURIES, na.rm = TRUE),
TotalHealthImpact = Fatalities + Injuries) %>%
arrange(desc(TotalHealthImpact)) %>%
slice(1:10)
# Plot: Health Impact
ggplot(health_impact, aes(x = reorder(EVTYPE, -TotalHealthImpact), y = TotalHealthImpact)) +
geom_bar(stat = "identity", fill = "firebrick") +
labs(title = "Top 10 Most Harmful Weather Events to Population Health",
x = "Event Type", y = "Total Fatalities + Injuries") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
# Summarize economic damage by event type
economic_impact <- storm_data %>%
group_by(EVTYPE) %>%
summarise(TotalPropertyDamage = sum(PROPDMGVAL, na.rm = TRUE),
TotalCropDamage = sum(CROPDMGVAL, na.rm = TRUE),
TotalEconomicDamage = TotalPropertyDamage + TotalCropDamage) %>%
arrange(desc(TotalEconomicDamage)) %>%
slice(1:10)
# Plot: Economic Impact
ggplot(economic_impact, aes(x = reorder(EVTYPE, -TotalEconomicDamage), y = TotalEconomicDamage / 1e9)) +
geom_bar(stat = "identity", fill = "steelblue") +
labs(title = "Top 10 Weather Events with Greatest Economic Impact",
x = "Event Type", y = "Total Damage (in Billions USD)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))