NOAA Storm Database Severe Weather Event Data Analysis

Synopsis

Storms and other severe weather events can cause both public health and economic problems for communities and municipalities. The U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm 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, property damage, and crop damage.

This report addresses two questions:

  • Across the United States, which types of events are most harmful with respect to population health?
  • Across the United States, which types of events have the greatest economic consequences?

The data Analyses demonstrate:

  • Tornadoes cause the most injuiries and fatalities
  • Floods cause the most property damage and had the highest overall economic impact
  • Droughts cause the most crop damage

Data Processing

#Load the data
storm <-read.csv("repdata_data_StormData.csv.bz2", header = TRUE, sep=",", check.names=FALSE, stringsAsFactors=FALSE)

#Remove the unecessary columns
storm <- storm[, c("BGN_DATE", "EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")]

Process the data to address the population health question

#Dataframe that sums fatalities and injuries by EVTYPE
library(plyr)
PopHealth<-ddply(storm, c("EVTYPE"), summarise, SumFAT=sum(FATALITIES, na.rm = T), SumINJ=sum(INJURIES, na.rm = T))

#Create a sorted top 10 fatality dataframe
FAT10<-PopHealth[order(-PopHealth$SumFAT),][1:10, ]

#Create a sorted top 10 injury dataframe
INJ10<-PopHealth[order(-PopHealth$SumINJ),][1:10, ]

Process the data to address the economic impact question

#EconTable dataframe that sums property damage by EVTYPE, PROPDMGEXP, and CROPDMGEXP
EconTable<-ddply(storm, c("EVTYPE", "PROPDMGEXP", "CROPDMGEXP"), summarise, SumProp=sum(PROPDMG, na.rm = T), SumCrop=sum(CROPDMG, na.rm = T))

#Determine the economic damage exponent identifiers that will be used to calculate actual damage amounts
unique(EconTable$PROPDMGEXP)
##  [1] "K" ""  "M" "+" "?" "0" "4" "5" "7" "B" "1" "2" "8" "H" "m" "-" "3"
## [18] "h" "6"
unique(EconTable$CROPDMGEXP)
## [1] ""  "M" "K" "0" "B" "?" "k" "m" "2"
#ComputeTotal Function that calculates the actual damage amounts using the economic damage exponent identifier and the economic damage  
ComputeTotal <- function(EXPONENT, Total){
  if(EXPONENT=="K")
    return(Total*1000)
  if(EXPONENT=="k")
    return(Total*1000)
  if(EXPONENT=="M")
    return(Total*1000000)
  if(EXPONENT=="m")
    return(Total*1000000)
  if(EXPONENT=="B")
    return(Total*1000000000)
  if(EXPONENT=="0")
    return(Total*1)
  if(EXPONENT=="0")
    return(Total*1)
  if(EXPONENT=="1")
    return(Total*10)
  if(EXPONENT=="2")
    return(Total*100)
  if(EXPONENT=="3")
    return(Total*1000)
  if(EXPONENT=="4")
    return(Total*10000)
  if(EXPONENT=="5")
    return(Total*100000)
  if(EXPONENT=="6")
    return(Total*1000000)
  if(EXPONENT=="7")
    return(Total*10000000)
  if(EXPONENT=="8")
    return(Total*100000000)
  else
    return(0)
}

#Applies the ComputeTotal function to property exponent identifier and property damage in EconTable
EconTable$TotalProp<-mapply(ComputeTotal, EconTable$PROPDMGEXP, EconTable$SumProp)

#Applies the ComputeTotal function to crop exponent identifier and crop damage in EconTable
EconTable$TotalCrop<-mapply(ComputeTotal, EconTable$CROPDMGEXP, EconTable$SumCrop)

#Creates a Total Damage column in EconTable
EconTable$TotalDam<-(EconTable$TotalProp+EconTable$TotalCrop)

#Final Economic Damage dataframe that sums Propery Damage, Crop Damage, and Total Damage by EVTYPE
EconDamage<-ddply(EconTable,c("EVTYPE"),summarise, SumProp=sum(TotalProp, na.rm = T), SumCrop=sum(TotalCrop, na.rm = T), SumDam=sum(TotalDam, na.rm = T))

#Create a sorted top 10 Property Damage dataframe
Prop10<-EconDamage[order(-EconDamage$SumProp),][1:10, ]

#Create a sorted top 10 Crop Damage dataframe
Crop10<-EconDamage[order(-EconDamage$SumCrop),][1:10, ]

#Create a sorted top 10 Total Economic Damage dataframe
Econ10<-EconDamage[order(-EconDamage$SumDam),][1:10, ]

Results

Graphs of Top 10 Injuries and Fatalities by Weather Event

par(mfrow = c(1, 2), mar = c(12, 4, 3, 2))
barplot(INJ10$SumINJ,  las = 3, names = INJ10$EVTYPE, main = "Top 10 Injuries", ylab = "Number of Injuries", col = "red")
barplot(FAT10$SumFAT,  las = 3, names = FAT10$EVTYPE, main = "Top 10 Fatalities", ylab = "Number of Fatalities", col = "red")

Graphs of Top 10 Property, Crop, and Total Cost of Damages by Weather Event

par(mfrow = c(1, 3), mar = c(12, 4, 3, 2))
barplot(Prop10$SumProp/(10^9),  las = 3, names = Prop10$EVTYPE, main = "Top 10 Property Damage", ylab = "Cost of damages ($ billions)", col = "blue")
barplot(Crop10$SumCrop/(10^9),  las = 3, names = Crop10$EVTYPE, main = "Top 10 Crop Damage", ylab = "Cost of damages ($ billions)", col = "blue")
barplot(Econ10$SumDam/(10^9),  las = 3, names = Econ10$EVTYPE, main = "Top 10 Total Damage", ylab = "Cost of damages ($ billions)", col = "blue")