This analysis explores the NOAA Storm Database to identify which weather events in the United States from 1950 to 2011 are most harmful to population health and which cause the greatest economic damage. We focus on fatalities and injuries for health impacts and property damage for economic consequences. The data is loaded from a compressed CSV file and processed using R. We clean the event types to ensure consistency and summarize the data to find the most impactful events. Results show the top event types for health and economic damage using tables and plots. The analysis is designed to inform resource prioritization for severe weather preparedness.
# Load libraries
library(dplyr)
library(ggplot2)
library(readr)
# Load the dataset
storm_data <- read_csv("C:\Users\DHRUMI\Downloads\repdata_data_StormData.csv.bz2")
# Check the structure
str(storm_data)
# Select only relevant columns
storm_subset <- storm_data %>%
select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)
# Convert damage exponents to actual numbers
exp_converter <- function(x) {
if (is.na(x)) return(0)
switch(toupper(x),
"H" = 100,
"K" = 1e3,
"M" = 1e6,
"B" = 1e9,
"0" = 1,
"1" = 10,
"2" = 100,
"3" = 1000,
"4" = 10000,
"5" = 1e5,
"6" = 1e6,
"7" = 1e7,
"8" = 1e8,
"9" = 1e9,
1)
}
storm_subset <- storm_subset %>%
mutate(
PROPDMGEXP = sapply(PROPDMGEXP, exp_converter),
CROPDMGEXP = sapply(CROPDMGEXP, exp_converter),
PROP_DAMAGE = PROPDMG * as.numeric(PROPDMGEXP),
CROP_DAMAGE = CROPDMG * as.numeric(CROPDMGEXP),
TOTAL_DAMAGE = PROP_DAMAGE + CROP_DAMAGE
)
# Summarize fatalities and injuries
health_impact <- storm_subset %>%
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)) %>%
slice_head(n = 10)
# Plot
ggplot(health_impact, aes(x = reorder(EVTYPE, Total_Harm), y = Total_Harm)) +
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")
# Summarize economic damage
economic_impact <- storm_subset %>%
group_by(EVTYPE) %>%
summarise(Total_Damage = sum(TOTAL_DAMAGE, na.rm = TRUE)) %>%
arrange(desc(Total_Damage)) %>%
slice_head(n = 10)
# Plot
ggplot(economic_impact, aes(x = reorder(EVTYPE, Total_Damage), y = Total_Damage/1e9)) +
geom_bar(stat = "identity", fill = "steelblue") +
coord_flip() +
labs(title = "Top 10 Events With Highest Economic Damage",
x = "Event Type", y = "Total Damage (in Billions USD)")