Synopsis

This analysis looks at NOAA Storm Data to investigate the health and economic impact of severe weather events. Severe weather events can have significant adverse effects on both the health of the population as well as economic impact to property and crops. In this study we identify the top 20 storm event types that have had the greatest overall impact population health and property and crop damages measured by cost of damages.

Data Processing

The NOAA Storm Data is downloaded directly from NOAA from this link and loaded from the csv file.

library(ggplot2)
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(reshape2)
library(RColorBrewer)
library(knitr)
knitr::opts_chunk$set(echo = TRUE)

download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", destfile="repdata_data_StormData.csv.bz2")
stormData <- read.csv("repdata_data_StormData.csv.bz2")

In analyzing the health impact, the INJURIES and FATALITIES fields are summed, grouped by EVTYPE. Many of the resulting records have no population impact, so these records are removed from the resulting data. The resulting data is further trimmed down to the top 20 records to simplify viewing.

# -----------------------------
# storm data by casualty types
# -----------------------------
stormDataCas <- aggregate(x=cbind(stormData$INJURIES, stormData$FATALITIES) ~ stormData$EVTYPE, data=stormData, FUN=sum)
stormDataCas <- setNames(stormDataCas, c("EVTYPE", "INJURIES", "FATALITIES"))
stormDataCas <- stormDataCas[rowSums(stormDataCas[2:3]) > 0,]
stormDataCas <- stormDataCas[order(rowSums(stormDataCas[2:3]), decreasing = TRUE),]

stormDataCas_20 <- stormDataCas[1:20,]

In analyzing the economic impact, new columns are created to transform the property damage and crop damage variables into numeric compatible fields (PROPCOST and CROPCOST). These fields are then added together to calculate the TOTALCOST for each record.

The TOTALCOST field is the summed, grouped by EVTYPE. Many of the resulting records have no economic impact, so these records are removed from the resulting data. The resulting data is further trimmed down to the top 20 records to simplify viewing.

# -------------------------------
# storm data by economic damages
# -------------------------------
stormDataEcon <- stormData
stormDataEcon$PROPCOST <- case_match(stormDataEcon$PROPDMGEXP,
                                    'K' ~ stormDataEcon$PROPDMG * 1000,
                                    'M' ~ stormDataEcon$PROPDMG * 1000000,
                                    'B' ~ stormDataEcon$PROPDMG * 1000000000,
                                    .default = stormDataEcon$PROPDMG)
stormDataEcon$CROPCOST <- case_match(stormDataEcon$CROPDMGEXP,
                                    'K' ~ stormDataEcon$CROPDMG * 1000,
                                    'M' ~ stormDataEcon$CROPDMG * 1000000,
                                    'B' ~ stormDataEcon$CROPDMG * 1000000000,
                                    .default = stormDataEcon$CROPDMG)
stormDataEcon$TOTALCOST <- stormDataEcon$PROPCOST + stormDataEcon$CROPCOST

stormDataEconEvt <- aggregate(x=stormDataEcon$TOTALCOST ~ stormDataEcon$EVTYPE, data=stormDataEcon, FUN=sum)
stormDataEconEvt <- setNames(stormDataEconEvt, c("EVTYPE", "TOTALCOST"))
stormDataEconEvt <- stormDataEconEvt[stormDataEconEvt$TOTALCOST > 0,]
stormDataEconEvt <- stormDataEconEvt[order(as.numeric(stormDataEconEvt$TOTALCOST), decreasing = TRUE),]

stormDataEconEvt_20 <- stormDataEconEvt[1:20,]

Results

The figures below show graphical plots of the top 20 storm event types that have had the greatest cumulative adverse effect on population health and economic impact measured by cost of damages.

stormDataCas_20M <- melt(stormDataCas_20, id="EVTYPE", measure.vars=c("INJURIES", "FATALITIES"), variable.name="Casualties", value.name="COUNT")
stormDataCas_20M$INJURY_TYPE <- relevel(stormDataCas_20M$Casualties, "FATALITIES")

g <- ggplot(stormDataCas_20M, aes(x=reorder(EVTYPE, -COUNT), y=COUNT, fill=Casualties))
g + geom_col() + 
  theme(axis.text.x=element_text(angle=90,hjust=1)) + 
  scale_fill_manual(values=c('red2','royalblue4')) + 
  labs(x="Storm Event", y="Casualties", title="Top 20 Harmful Storm Event Types in US")