Introducction: # This analysis examined the U.S. National Weather
Service (NWS) Storm Database to : 1 Most Harmful Events to Population
Health; 2 Events with Greatest Economic Consequences
Data Processing
data loading
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)
#dir("repdata_data_StormData")
dat1 <- read.csv("repdata_data_StormData/repdata_data_StormData.csv")
data analysis
1. To detremin which types of events (as indicated in the EVTYPE)
are most harmful with respect to population health
harm_summary <- tapply(dat1$FATALITIES, dat1$EVTYPE, sum, na.rm = TRUE) +
tapply(dat1$INJURIES, dat1$EVTYPE, sum, na.rm = TRUE) %>%
as.data.frame() %>%
rename(total_harm = ".")
harm_summary <- harm_summary %>%
arrange(desc(total_harm)) %>% as.data.frame()
harm_summary$EVTYPE <- rownames(harm_summary)
# View the top 5 most harmful events
Justification: The raw data contains separate columns for FATALITIES
and INJURIES, requiring aggregation to accurately assess total
population health impact. By summing these metric
result 1:
ggplot(harm_summary[1:5, ], aes(x = reorder(EVTYPE, -total_harm), y = total_harm)) +
geom_col(fill = "blue") +
geom_text(aes(label = total_harm), vjust = -0.5) +
labs(title = "Top 5 Most Harmful Weather Events to Population Health",
x = "Event Type",
y = "Total Harm (Fatalities + Injuries)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) + theme_classic()

2. To determine which types of events cause the greatest economic
losses
Justification: Raw data stores damage values separately from their
units, making aggregation impossible without conversion to consistent
units
result 2:
ggplot(economic_impact[1:5, ], aes(x = reorder(EVTYPE, -total_damage), y = total_damage)) +
geom_col(fill = "blue") +
geom_text(aes(label = total_damage), vjust = -0.5) +
labs(title = "Top 5 Most Harmful Weather Events to Total Damage",
x = "Event Type",
y = "Total Damage (Crop Damage + Property Damage)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) + theme_classic()

Synopsis:
This analysis of NOAA Storm Data reveals tornadoes as the most
dangerous events to population health, causing the majority of
weather-related fatalities and injuries. For economic damage, floods and
hurricanes are the costliest, with billions in property and crop losses.
Data was standardized to compare impacts consistently, using
transformations like damage value conversion (e.g., “1.5B” → $1.5
billion) and event-type normalization. The findings highlight tornado
preparedness and flood-resistant infrastructure as critical priorities
for public safety and economic stability.