Synopsis

This analysis explores the NOAA Storm Database to determine which weather events are most harmful to population health and which have the greatest economic impact. The dataset includes records from 1950 to 2011. Population health impact is measured using fatalities and injuries, while economic impact is measured using property and crop damage. The results show that tornadoes are the most harmful to population health. Floods and hurricanes have the greatest economic consequences. This analysis helps identify which disasters require more preparation and resources.

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
library(ggplot2)

# Load data
data <- read.csv("repdata_data_StormData.csv.bz2")

# Select required columns
storm <- data %>%
  select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)

# Function to convert exponent
convert_exp <- function(exp) {
  ifelse(exp == "K", 1e3,
  ifelse(exp == "M", 1e6,
  ifelse(exp == "B", 1e9, 1)))
}

# Apply conversion
storm$PROPDMGEXP <- convert_exp(storm$PROPDMGEXP)
storm$CROPDMGEXP <- convert_exp(storm$CROPDMGEXP)

storm$PROPDMG_TOTAL <- storm$PROPDMG * storm$PROPDMGEXP
storm$CROPDMG_TOTAL <- storm$CROPDMG * storm$CROPDMGEXP

# Health impact
health <- storm %>%
  group_by(EVTYPE) %>%
  summarise(FATALITIES = sum(FATALITIES),
            INJURIES = sum(INJURIES)) %>%
  arrange(desc(FATALITIES + INJURIES))
## `summarise()` ungrouping output (override with `.groups` argument)
# Economic impact
economic <- storm %>%
  group_by(EVTYPE) %>%
  summarise(DAMAGE = sum(PROPDMG_TOTAL + CROPDMG_TOTAL)) %>%
  arrange(desc(DAMAGE))
## `summarise()` ungrouping output (override with `.groups` argument)