This report analyzes the NOAA Storm Database to determine which types of severe weather events are most harmful to population health and which have the greatest economic consequences across the United States. The analysis includes data transformations, filtering, and aggregation to summarize fatalities, injuries, property damage, and crop damage. We find that tornadoes cause the most fatalities and injuries, while floods and hurricanes have the highest economic impact.
# Load required libraries
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
library(ggplot2)
library(readr)
# Read the data
storm <- read.csv("repdata_data_StormData.csv", stringsAsFactors = FALSE)
# Convert event type to uppercase for consistency
storm$EVTYPE <- toupper(storm$EVTYPE)
# Filter out events with zero impact
storm_filtered <- storm %>%
filter(FATALITIES > 0 | INJURIES > 0 | PROPDMG > 0 | CROPDMG > 0)
# Standardize property damage
convert_exp <- function(val, exp) {
exp <- toupper(exp)
if (exp == "K") val * 1e3
else if (exp == "M") val * 1e6
else if (exp == "B") val * 1e9
else if (grepl("[0-9]", exp)) val * (10 ^ as.numeric(exp))
else val
}
storm_filtered$PROPDMGVALUE <- mapply(convert_exp,storm_filtered$PROPDMG, storm_filtered$PROPDMGEXP)
storm_filtered$CROPDMGVALUE <- mapply(convert_exp,storm_filtered$CROPDMG, storm_filtered$CROPDMGEXP)
health_impact <- storm_filtered %>%
group_by(EVTYPE) %>%
summarise(
Fatalities = sum(FATALITIES, na.rm = TRUE),
Injuries = sum(INJURIES, na.rm = TRUE)
) %>%
mutate(Total = Fatalities + Injuries) %>%
arrange(desc(Total)) %>%
slice(1:10)
ggplot(health_impact, aes(x = reorder(EVTYPE, Total), y = Total)) +
geom_bar(stat = "identity", fill = "red") +
coord_flip() +
labs(title = "Top 10 Weather Events by Total Fatalities and Injuries",
x = "Event Type", y = "Total Fatalities + Injuries")
Figure 1: This bar plot shows the top 10 most harmful weather events to
population health, based on combined fatalities and injuries.
economic_impact <- storm_filtered %>%
group_by(EVTYPE) %>%
summarise(
PropertyDamage = sum(PROPDMGVALUE, na.rm = TRUE),
CropDamage = sum(CROPDMGVALUE, na.rm = TRUE),
TotalDamage = PropertyDamage + CropDamage
) %>%
arrange(desc(TotalDamage)) %>%
slice(1:10)
ggplot(economic_impact, aes(x = reorder(EVTYPE, TotalDamage), y = TotalDamage/1e9)) +
geom_bar(stat = "identity", fill = "blue") +
coord_flip() +
labs(title = "Top 10 Weather Events by Total Economic Damage",
x = "Event Type", y = "Damage (in Billions USD)")
Figure 2: This plot illustrates the top 10 weather events causing the
highest total economic losses from property and crop damages.
Tornadoes are the most harmful to human health in terms of fatalities and injuries, while floods and hurricanes/typhoons are the most economically damaging events in the United States. These findings suggest a need for improved preparedness and mitigation strategies focused on these high-impact weather events.