This analysis uses the NOAA Storm Database to examine which types of weather events are most harmful to population health and which have the greatest economic impact. The dataset is loaded from the raw compressed file and processed in R. Property and crop damage values are converted into numeric values using exponent mappings. The data are aggregated by event type to calculate total fatalities, injuries, and economic damage. The results show that tornadoes and excessive heat are the most harmful to human health, while floods and hurricanes cause the greatest economic losses.
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)
# Load raw data
storm_data <- read.csv("D:/Case Study/repdata_data_StormData.csv")
# Convert exponents to uppercase
storm_data$PROPDMGEXP <- toupper(storm_data$PROPDMGEXP)
storm_data$CROPDMGEXP <- toupper(storm_data$CROPDMGEXP)
# Map exponent values
exp_map <- c('H'=1e2, 'K'=1e3, 'M'=1e6, 'B'=1e9)
# Create numeric damage values
storm_data$PROPDMGNUM <- storm_data$PROPDMG * ifelse(storm_data$PROPDMGEXP %in% names(exp_map),
exp_map[storm_data$PROPDMGEXP], 1)
storm_data$CROPDMGNUM <- storm_data$CROPDMG * ifelse(storm_data$CROPDMGEXP %in% names(exp_map),
exp_map[storm_data$CROPDMGEXP], 1)
health_impact <- storm_data %>%
group_by(EVTYPE) %>%
summarise(Total_Fatalities = sum(FATALITIES, na.rm=TRUE),
Total_Injuries = sum(INJURIES, na.rm=TRUE)) %>%
arrange(desc(Total_Fatalities + Total_Injuries))
head(health_impact, 10)
## # A tibble: 10 × 3
## EVTYPE Total_Fatalities Total_Injuries
## <chr> <dbl> <dbl>
## 1 TORNADO 5633 91346
## 2 EXCESSIVE HEAT 1903 6525
## 3 TSTM WIND 504 6957
## 4 FLOOD 470 6789
## 5 LIGHTNING 816 5230
## 6 HEAT 937 2100
## 7 FLASH FLOOD 978 1777
## 8 ICE STORM 89 1975
## 9 THUNDERSTORM WIND 133 1488
## 10 WINTER STORM 206 1321
top10_health <- head(health_impact, 10)
ggplot(top10_health, aes(x=reorder(EVTYPE, Total_Fatalities + Total_Injuries),
y=Total_Fatalities + Total_Injuries)) +
geom_bar(stat="identity", fill="red") +
coord_flip() +
labs(title="Top 10 Storm Events by Health Impact",
y="Fatalities + Injuries",
x="Event Type")
economic_impact <- storm_data %>%
group_by(EVTYPE) %>%
summarise(Total_Prop_Damage = sum(PROPDMGNUM, na.rm=TRUE),
Total_Crop_Damage = sum(CROPDMGNUM, na.rm=TRUE)) %>%
arrange(desc(Total_Prop_Damage + Total_Crop_Damage))
head(economic_impact, 10)
## # A tibble: 10 × 3
## EVTYPE Total_Prop_Damage Total_Crop_Damage
## <chr> <dbl> <dbl>
## 1 FLOOD 144657709807 5661968450
## 2 HURRICANE/TYPHOON 69305840000 2607872800
## 3 TORNADO 56937160779. 414953270
## 4 STORM SURGE 43323536000 5000
## 5 HAIL 15732267543. 3025954473
## 6 FLASH FLOOD 16140812067. 1421317100
## 7 DROUGHT 1046106000 13972566000
## 8 HURRICANE 11868319010 2741910000
## 9 RIVER FLOOD 5118945500 5029459000
## 10 ICE STORM 3944927860 5022113500
top10_econ <- head(economic_impact, 10)
ggplot(top10_econ, aes(x=reorder(EVTYPE, Total_Prop_Damage + Total_Crop_Damage),
y=Total_Prop_Damage + Total_Crop_Damage)) +
geom_bar(stat="identity", fill="blue") +
coord_flip() +
labs(title="Top 10 Storm Events by Economic Damage",
y="Total Damage (USD)",
x="Event Type")
The analysis shows that tornadoes and excessive heat are the most harmful events in terms of population health, causing the highest number of fatalities and injuries. Floods and hurricanes have the greatest economic impact, leading to the highest property and crop damages. These findings can help decision-makers prioritize resources for disaster preparedness and response.