This report analyzes the NOAA Storm Database to identify which types of severe weather events are most harmful to population health and have the greatest economic consequences in the United States. We examine event types using key variables: fatalities, injuries, property damage, and crop damage. The goal is to support data-driven resource allocation for emergency preparedness. Data is loaded from the raw CSV file, cleaned, and aggregated to compare the impacts across event types.
# Load compressed data
storm_data <- read.csv("repdata_data_StormData.csv.bz2")
# Aggregate fatalities and injuries by event type
event_health <- storm_data %>%
group_by(EVTYPE) %>%
summarise(fatalities = sum(FATALITIES, na.rm = TRUE),
injuries = sum(INJURIES, na.rm = TRUE)) %>%
mutate(total_health_impact = fatalities + injuries) %>%
arrange(desc(total_health_impact))
# Top 10 most harmful events
top_health <- event_health[1:10, ]
# Convert property and crop damage
convert_exp <- function(val, exp) {
if (exp == "K") val * 1e3
else if (exp == "M") val * 1e6
else if (exp == "B") val * 1e9
else val
}
storm_data <- storm_data %>%
mutate(PROPDMGEXP = toupper(as.character(PROPDMGEXP)),
CROPDMGEXP = toupper(as.character(CROPDMGEXP)),
prop_damage = mapply(convert_exp, PROPDMG, PROPDMGEXP),
crop_damage = mapply(convert_exp, CROPDMG, CROPDMGEXP))
# Aggregate economic damage by event type
event_econ <- storm_data %>%
group_by(EVTYPE) %>%
summarise(total_prop = sum(prop_damage, na.rm = TRUE),
total_crop = sum(crop_damage, na.rm = TRUE)) %>%
mutate(total_econ_impact = total_prop + total_crop) %>%
arrange(desc(total_econ_impact))
# Top 10 events by economic damage
top_econ <- event_econ[1:10, ]
ggplot(top_health, aes(x = reorder(EVTYPE, total_health_impact), y = total_health_impact)) +
geom_col(fill = "tomato") +
coord_flip() +
labs(title = "Top 10 Weather Events by Health Impact",
x = "Event Type", y = "Total Fatalities + Injuries")
ggplot(top_econ, aes(x = reorder(EVTYPE, total_econ_impact), y = total_econ_impact / 1e9)) +
geom_col(fill = "steelblue") +
coord_flip() +
labs(title = "Top 10 Weather Events by Economic Impact",
x = "Event Type", y = "Economic Impact (in Billions USD)")