Synopsis

This analysis explores the NOAA Storm Database to identify which types of events are most harmful to population health and which have the greatest economic consequences in the United States. The data includes information on fatalities, injuries, and property and crop damage. The results show that tornadoes are the most harmful to population health, while floods and hurricanes cause the greatest economic damage.


Data Processing

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
# Load data
data <- read.csv("repdata_data_StormData.csv.bz2")

# Keep relevant columns
data <- data %>%
  select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)

# Convert damage multipliers
convert_exp <- function(x) {
  x <- toupper(x)
  if (x == "K") return(1000)
  if (x == "M") return(1e6)
  if (x == "B") return(1e9)
  return(1)
}

data$PROPDMG <- data$PROPDMG * sapply(data$PROPDMGEXP, convert_exp)
data$CROPDMG <- data$CROPDMG * sapply(data$CROPDMGEXP, convert_exp)