This analysis explores the NOAA Storm Database to identify which weather events are most harmful to population health and cause the greatest economic damage.
data <- read.csv("C:\\Users\\rshru\\Downloads\\repdata_data_StormData.csv\\repdata_data_StormData.csv")
storm <- data[, c("EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP")]
storm$PROPDMGEXP <- toupper(storm$PROPDMGEXP)
storm$multiplier <- ifelse(storm$PROPDMGEXP == "K", 1e3,
ifelse(storm$PROPDMGEXP == "M", 1e6,
ifelse(storm$PROPDMGEXP == "B", 1e9, 1)))
storm$PROPDMG_TOTAL <- storm$PROPDMG * storm$multiplier
health <- aggregate(cbind(FATALITIES, INJURIES) ~ EVTYPE, data = storm, sum)
health$total <- health$FATALITIES + health$INJURIES
health <- health[order(-health$total), ]
top_health <- head(health, 10)
barplot(top_health$total,
names.arg = top_health$EVTYPE,
las = 2,
col = "red",
main = "Top 10 Harmful Weather Events",
ylab = "Fatalities + Injuries")
Tornadoes and heat events cause the most harm to population health.
economic <- aggregate(PROPDMG_TOTAL ~ EVTYPE, data = storm, sum)
economic <- economic[order(-economic$PROPDMG_TOTAL), ]
top_economic <- head(economic, 10)
barplot(top_economic$PROPDMG_TOTAL,
names.arg = top_economic$EVTYPE,
las = 2,
col = "blue",
main = "Top 10 Economic Damage Events",
ylab = "Damage ($)")
Floods and hurricanes cause the greatest economic damage.