Synopsis

This analysis explores the NOAA Storm Database to identify which types of weather events are most harmful to population health and which have the greatest economic consequences.

Data Processing

The data were loaded and cleaned. Damage multipliers were converted and total damage calculated.

library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.3
## 
## 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)

data <- read.csv("repdata_data_StormData.csv")

data$PROPDMGEXP <- as.character(data$PROPDMGEXP)
data$PROPDMGEXP[data$PROPDMGEXP == "K"] <- 1e3
data$PROPDMGEXP[data$PROPDMGEXP == "M"] <- 1e6
data$PROPDMGEXP[data$PROPDMGEXP == "B"] <- 1e9
data$PROPDMGEXP[!data$PROPDMGEXP %in% c(1e3,1e6,1e9)] <- 1
data$PROPDMGEXP <- as.numeric(data$PROPDMGEXP)

data$damage <- data$PROPDMG * data$PROPDMGEXP

health <- data %>%
  group_by(EVTYPE) %>%
  summarise(total = sum(FATALITIES + INJURIES)) %>%
  arrange(desc(total)) %>%
  head(10)

economic <- data %>%
  group_by(EVTYPE) %>%
  summarise(total = sum(damage)) %>%
  arrange(desc(total)) %>%
  head(10)

Results

The following plots show the most harmful events.

ggplot(health, aes(x = reorder(EVTYPE, total), y = total)) +
  geom_bar(stat = "identity") +
  coord_flip()

Tornadoes are the most harmful to population health.

ggplot(economic, aes(x = reorder(EVTYPE, total), y = total)) +
  geom_bar(stat = "identity") +
  coord_flip()

Floods and hurricanes cause the greatest economic damage.