This report analyzes the NOAA Storm Database to determine the most harmful weather events in the United States in terms of population health and economic impact. The dataset includes information on severe weather events, recorded injuries, faralities, and economic damages. The goal is to identify the most dangerous and costly events, helping policymakers allocate resources effectively.
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)
#Download and load data
storm_data <- read.csv("repdata-data-StormData.csv")
#Select relevant colums
data <- storm_data %>% select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)
#Convert property and crop damage values
exp_conversion <- function(exp) {
if (exp %in% c("K", "k")) return (1e3)
if (exp %in% c("M", "m")) return (1e6)
if (exp %in% c("B", "b")) return (1e9)
if (grepl("^[0-9]$", exp)) return (10^as.numeric(exp))
return (1)
}
data$PROPDMEGXP <- sapply(data$PROPDMGEXP, exp_conversion)
data$CROPDMGEXP <- sapply(data$CROPDMGEXP, exp_conversion)
data <- data %>% mutate(
PROPDMG = as.numeric(PROPDMG)*as.numeric(PROPDMGEXP),
CROPDMG = as.numeric(CROPDMG)*as.numeric(CROPDMGEXP),
TOTALDMG = PROPDMG + CROPDMG
)
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `PROPDMG = as.numeric(PROPDMG) * as.numeric(PROPDMGEXP)`.
## Caused by warning:
## ! NAs introduced by coercion
health_impact <- data %>%
group_by(EVTYPE) %>%
summarise(Total_Fatalities = sum(FATALITIES, na.rm = TRUE),
Total_Injuries = sum(INJURIES, na.rm = TRUE)) %>%
mutate(Total_Harm = Total_Fatalities + Total_Injuries) %>%
arrange(desc(Total_Harm)) %>%
head(10)
ggplot(health_impact, aes(x = reorder(EVTYPE, -Total_Harm),
y = Total_Harm, fill = EVTYPE)) +
geom_bar(stat = "identity") +
coord_flip() +
labs(title = "Top 10 Most Harmful Weather Events (Population Health)",
x = "Event Type", y = "Total Fatalities and Injuries") +
theme_minimal()
economic_impact <- data %>%
group_by(EVTYPE) %>%
summarise(Total_Economic_Damage = sum(TOTALDMG, na.rm = TRUE)) %>%
arrange(desc(Total_Economic_Damage)) %>%
head(10)
ggplot(economic_impact, aes(x = reorder(EVTYPE, -Total_Economic_Damage),
y = Total_Economic_Damage, fill = EVTYPE)) +
geom_bar(stat = "identity") +
coord_flip() +
labs(title = "Top 10 Weather Events with Greatest Economic Damage",
x = "Event Type", y = "Total Economic Damage ($)") +
theme_minimal()
From the analysis, tornadoes appear to be the most harmful weather event in terms of population health, causing the highest number of fatalities and injuries. In terms of economic impact, hurricanes, floods, and storm surges tend to cause the most significant financial damage. Understanding these trends helps emergency planners and policymakers make informed decisions on resource allocation and disaster preparedness.