title: "Health and Economic Impacts of Severe Weather Events in the United States"
author: "Arun"
date: "2026-07-04"
output: html_document

#Synopsis

#This analysis explores the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database to identify which severe weather events cause the most significant public health and economic impacts. The data, spanning from 1950 to 2011, was processed to aggregate fatalities, injuries, property damage, and crop damage by event type. Our findings indicate that [Event Type A] is the most harmful to population health, primarily driving fatalities and injuries. Meanwhile, [Event Type B] has the greatest economic consequences, resulting in the highest total property and crop damage costs across the United States.

#Data Processing #In this section, we load the necessary R packages and read the raw data file. We also perform data transformations to isolate the variables required to answer our core questions: EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, and CROPDMGEXP.

#Loading the Data

Load necessary libraries

library(dplyr) library(ggplot2)

Download the file if it doesn’t exist in the working directory

file_url <- “https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2” file_name <- “StormData.csv.bz2”

if (!file.exists(file_name)) { download.file(file_url, file_name, method = “curl”) }

Read the raw CSV file

storm_data <- read.csv(file_name)

#Cleaning and Transforming the Data

Subset the data to only include relevant columns to save memory

subset_data <- storm_data %>% select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)

##Results

#1.Most Harmful Events to Population Health # Calculate total health impact (Fatalities + Injuries) health_summary <- subset_data %>% group_by(EVTYPE) %>% summarize(Total_Fatalities = sum(FATALITIES, na.rm = TRUE), Total_Injuries = sum(INJURIES, na.rm = TRUE), Total_Harm = Total_Fatalities + Total_Injuries) %>% arrange(desc(Total_Harm)) %>% slice(1:10) # Get the top 10 most harmful events

View the top results

head(health_summary)

#Figure 1: Top 10 Weather Events by Population Health Impact

Plot the top 10 most harmful events

ggplot(health_summary, aes(x = reorder(EVTYPE, -Total_Harm), y = Total_Harm)) + geom_bar(stat = “identity”, fill = “steelblue”) + theme_minimal() + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + labs(title = “Top 10 Most Harmful Severe Weather Events in the US (1950-2011)”, x = “Event Type”, y = “Total Number of Fatalities and Injuries”)

2. Events with the Greatest Economic Consequences

Load necessary library

library(dplyr) library(ggplot2) # TODO: Add your code here to convert PROPDMGEXP and CROPDMGEXP into numeric multipliers # (e.g., K = 1,000; M = 1,000,000; B = 1,000,000,000) and calculate Total_Damage.

Convert the exponent symbols into numeric multipliers

economic_data <- subset_data %>% mutate( # Standardize to uppercase for easier matching PROPDMGEXP = toupper(PROPDMGEXP), CROPDMGEXP = toupper(CROPDMGEXP),

# Map letters to numbers (K = Thousands, M = Millions, B = Billions)
PROP_MULT = case_when(
  PROPDMGEXP == "K" ~ 1000,
  PROPDMGEXP == "M" ~ 1000000,
  PROPDMGEXP == "B" ~ 1000000000,
  TRUE ~ 1 # Default for empty or invalid characters
),
CROP_MULT = case_when(
  CROPDMGEXP == "K" ~ 1000,
  CROPDMGEXP == "M" ~ 1000000,
  CROPDMGEXP == "B" ~ 1000000000,
  TRUE ~ 1 
),

# Calculate actual dollar amounts
Total_Prop_Damage = PROPDMG * PROP_MULT,
Total_Crop_Damage = CROPDMG * CROP_MULT,

# Combine property and crop damage for total economic impact
Total_Economic_Damage = Total_Prop_Damage + Total_Crop_Damage

)

Summarize the total damage by Event Type

econ_summary <- economic_data %>% group_by(EVTYPE) %>% summarize(Total_Damage_Dollars = sum(Total_Economic_Damage, na.rm = TRUE)) %>% arrange(desc(Total_Damage_Dollars)) %>% slice(1:10) # Isolate the top 10 most costly events

Display the data table

print(econ_summary)

Plot the results

ggplot(econ_summary, aes(x = reorder(EVTYPE, -Total_Damage_Dollars), y = Total_Damage_Dollars)) + geom_bar(stat = “identity”, fill = “darkred”) + theme_minimal() + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + # Format the Y-axis to show standard numbers instead of scientific notation scale_y_continuous(labels = scales::comma) + labs(title = “Top 10 Weather Events with Greatest Economic Consequences (1950-2011)”, x = “Event Type”, y = “Total Economic Damage (in US Dollars)”)