Synopsis

This report analyzes data from the storm database provided by the National Oceanic and Atmospheric Administration to determine the most harmful storm events with respect to population health, and economic impact. For purposes of this report, population health is determined by the total number of fatalities and injuries caused by a storm event. Economic impact is determined by the total damage to property and crops. The results indicate that tornados were the leading cause of both injuries and fatalities, and therefore to population health. Flood was determined to be the storm event with the greatest economic consequences.

Data Processing

The data was downloaded from the link labeled “Storm Data” at https://www.coursera.org/learn/reproducible-research/peer/OMZ37/course-project-2 and was then read as follows.

library(dplyr, warn.conflicts=FALSE)
library(ggplot2)
data<-read.csv("repdata_data_StormData.csv.bz2", header=TRUE, 
            na.strings=c("NA", ""), stringsAsFactors = FALSE)

New columns for property damage costs, crop damage costs, and total damage costs were created and added to the dataframe to reflect (i) multipliers were contained in separate columns, which need to be applied to the two original property and crop damage columns, and (ii) a new total damage variable reflecting the total sum of the computed property and crop damage amounts described in (i).

d<-data %>%
    mutate(totalprop = ifelse(PROPDMGEXP == "K", PROPDMG * 1000,
                              ifelse(PROPDMGEXP == "M", PROPDMG * 1000000,
                            ifelse(PROPDMGEXP == "B", PROPDMG * 1000000000, NA)))) %>%
    mutate(totalcrop = ifelse(CROPDMGEXP == "K", CROPDMG * 1000,
                              ifelse(CROPDMGEXP == "M", CROPDMG * 1000000,
                            ifelse(CROPDMGEXP == "B", CROPDMG * 1000000000, NA)))) %>%
    mutate(totald=totalprop + totalcrop)  

Results

  1. Across the US, which types of events are most harmful with respect to population health?

To answer this question, two analyses were done. First, to determine which events caused the most fatalities. Second, to determine which events caused the most injuries.

f<-aggregate(d$FATALITIES, list(tolower(d$EVTYPE)), FUN=sum, na.rm=TRUE)
colnames(f)<-c("event", "fatalities")
fatalities<- f %>%
     filter(fatalities > 0) %>%
     arrange(desc(fatalities))

mostharmful<-fatalities[1:5,]
barplot(mostharmful$fatalities, names.arg=mostharmful$event,
        main="Top 5 Fatality Causing Events",
        ylab = "Number of Fatalities")

inj<-aggregate(d$INJURIES, list(tolower(d$EVTYPE)), FUN=sum, na.rm=TRUE)
colnames(inj)<-c("event", "injuries")
injuries<- inj %>%
    filter(injuries > 0) %>%
    arrange(desc(injuries))

mostinjuries<-injuries[1:5,]
barplot(mostinjuries$injuries, names.arg=mostinjuries$event,
        main="Top 5 Injury Causing Events",
        ylab = "Number of Injuries")

As shown in the two barplots above, tornados were the leading cause of both injuries and fatalities.

  1. Across the US, which types of events have the greatest economic consequences?

To answer this question, I separately analyzed which events caused the most property damage, and which events caused the most crop damage, as well as the combined damage. The following plot shows the results of these 3 calculations.

psum<-aggregate(d$totalprop, list(tolower(d$EVTYPE)), FUN=sum, na.rm=TRUE)
colnames(psum)<-c("event", "propdamage")
psum<-arrange(psum, desc(propdamage))

csum<-aggregate(d$totalcrop, list(tolower(d$EVTYPE)), FUN=sum, na.rm=TRUE)
colnames(csum)<-c("event", "cropdamage")
csum<-arrange(csum, desc(cropdamage))

tsum<-aggregate(d$totald, list(tolower(d$EVTYPE)), FUN=sum, na.rm=TRUE)
colnames(tsum)<-c("event", "totaldamage")
tsum<-arrange(tsum, desc(totaldamage))

#panel plot
pmostharmful<-psum[1:5,]
cmostharmful<-csum[1:5,]
tmostharmful<-tsum[1:5,]
par(mfrow=c(3,1), oma=c(0,0,5,0), mar=c(2,4,4,2))
with(pmostharmful, {

barplot(tmostharmful$totaldamage, names.arg=tmostharmful$event,
        main="Property and Crop Damage",
        ylab = "Damage Cost")
  
barplot(pmostharmful$propdamage, names.arg=pmostharmful$event,
         main="Property Damage",
         ylab = "Damage Cost")  

barplot(cmostharmful$cropdamage, names.arg=cmostharmful$event,
        main="Crop Damage",
        #las=2,
        ylab = "Damage Cost")  

mtext("Top 5 Property and Crop Damage Events", outer=TRUE)

})   

As shown by the panel plot above, drought is the leading cause of crop damage, flood is the leading cause of property damage, and the leading cause of combined property and crop damage.