Synopsis

In this report we aim to explore and analyze the NOAA Storm Database Data for the United States. This database tracks characteristics of major storms and weather events in the United States, including when and where they occur, as well as estimates of any fatalities, injuries, and property damage. The events in the database start in the year 1950 and end in November 2011. Our overall analysis is to address two key questions: 1. Across the United States, which types of events are most harmful with respect to population health? 2. Across the United States, which types of events have the greatest economic consequences?

Load the required packages

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)

Data Processing

The dataset is first downloaded from the given link and loaded into dataframe StormData

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

To ascertain damage by Event type, only the required columns are kept.

StormDamage <- StormData %>%
  select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)

After sub-setting, the damage multipliers are converted to numerical values and damages are calculated (Empty values for EXP are treated as 1, same rule is applied for ‘0’ values)

NumVal <- c("K"=1e3, "k"=1e3, "M"=1e6, "m"=1e6, "B"=1e9, "b"=1e9, "0"=1)

StormDamage <- StormDamage %>%
  mutate(PROPDMGEXP=ifelse(PROPDMGEXP %in% names(NumVal), NumVal[PROPDMGEXP],1), 
         CROPDMGEXP=ifelse(CROPDMGEXP %in% names(NumVal), NumVal[CROPDMGEXP],1), 
         Prop_damage = PROPDMG * PROPDMGEXP, 
         Crop_damage = CROPDMG * CROPDMGEXP, 
         Total_damage = Prop_damage + Crop_damage
         )

The damage totals are calculated per EVTYPE as follows:

StormDamage <- StormDamage %>%
  group_by(EVTYPE) %>%
  summarise(
    Total_Fatalities = sum(FATALITIES, na.rm = TRUE),
    Total_Injuries = sum(INJURIES, na.rm = TRUE),
    Total_Health = sum(FATALITIES + INJURIES, na.rm = TRUE),
    Total_Property = sum(Prop_damage, na.rm = TRUE),
    Total_Crop = sum(Crop_damage, na.rm = TRUE),
    Total_Economic = sum(Total_damage, na.rm = TRUE),
  ) %>%
  arrange(desc(Total_Health))

top10_byHealth <- StormDamage %>%
  slice_max(Total_Health, n=10)

top10_byEconomic <- StormDamage %>%
  slice_max(Total_Economic, n=10)

Results

Evaluate Top Total_Health events using ggplot2

ggplot(top10_byHealth, aes(x=reorder(EVTYPE, Total_Health), y=Total_Health)) + geom_bar(stat="identity", fill="steelblue") + coord_flip() + labs(title = "Top 10 Events by Population Health damage", x = "Event Type", y = "Fatalities + Injuries")

Tornado Event Type stands out as the most damaging to Population Health

Evaluate Top Total_Economic events using ggplot2

ggplot(top10_byEconomic, aes(x=reorder(EVTYPE, Total_Economic), y=Total_Economic)) + geom_bar(stat="identity", fill="green") + coord_flip() + labs(title = "Top 10 Events by Economic damage", x = "Event Type", y = "Property Damage + Crop Damage")

Flood stands out as the highest economic damage causing event type

Conclusion

Data analysis of NOAA storm dataset was carried out using R and the analysis addressed two key questions :

1). Types of events most harmful to population health. According to the data, Tornadoes are indicated as the most damaging Event Type here

2). Types of events most harmful economically. Flood, followed by Hurricane/typhoon and Tornado event types conclude the top 3 most harmful events with regards to economic damage