Summary

This document describes the analysis of storm and weather event data taken from the NOAA database, which can be found under https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2. The data was analyzed and grouped by the event types, and the most impactful weather events in terms of fatalities, injuries and monetary damage were determined.

Data Processing

The .zip file containing the data was downloaded from the link above and extracted into the working directory. Data from the .csv file was read into R, and stored in a data table and grouped by event type for downstream analysis. For each type of weather event, the total number of fatalities, injuries or economical damage (sum of property damage and crop damage) was calculated. Damage amounts were normalized to USD based on the exponent given in the original data (K = 1,000, M = 1,000,000, etc.). Data was then arranged in descending order for each of the three categories and plotted. The code used for reading and processing the input file is as follows:

#Load data and packages
library(dplyr)
data <- read.csv("repdata_data_StormData.csv")

#For economical damage, convert all entries to dollar amount
data$PROPDMG[data$PROPDMGEXP == "K"] <- data$PROPDMG[data$PROPDMGEXP == "K"] * 1000
data$PROPDMG[data$PROPDMGEXP == "M"] <- data$PROPDMG[data$PROPDMGEXP == "M"] * 1000000
data$PROPDMG[data$PROPDMGEXP == "B"] <- data$PROPDMG[data$PROPDMGEXP == "B"] * 1000000000

#summarize number of fatalities, injuries and total econ. damage for each event type
datasummary<-data %>% group_by(EVTYPE) %>% summarize(fatalsum = sum(FATALITIES, na.rm=TRUE), injursum = sum(INJURIES, na.rm=TRUE), dmgsum = sum(sum(PROPDMG, na.rm=TRUE), sum(CROPDMG, na.rm=TRUE)))

In order to find and visualize the event types with the highest impact for each of the categories, this data table was arranged and plotted as follows:

#generate plots for health impact
top_fatalities <- head(arrange(datasummary, desc(fatalsum)),6)
top_injuries <- head(arrange(datasummary, desc(injursum)),6)
par(mfrow=c(2,1), mar = c(6,4,2,1))
barplot(top_fatalities$fatalsum,names.arg = top_fatalities$EVTYPE, las = 2,main="Fatalities")
barplot(top_injuries$injursum,names.arg = top_injuries$EVTYPE, las = 2,main="Injuries")

top_econdmg <- head(arrange(datasummary, desc(dmgsum)),6)
par(mfrow = c(1,1))
barplot(head(top_econdmg$dmgsum),names.arg = head(top_econdmg$EVTYPE), las = 2,main="Economical damage in USD")

Results

From this analysis, flood were found to have the highest economical impact, with property and crop damage together amounting to over 144657877844.88 USD. In terms of health impact, tornado caused the most fatalities with a count of 5633, and tornado caused the most injuries with a count of 91346