Synopsis

This report analyzes the impact of severe weather events on four outcomes relevant to population health and economic consequences. The data was obtained from https://www.ncdc.noaa.gov/stormevents/ and the “cost” of each outcome was grouped by event type such as “Ice Storm” or “Tornado”. The analysis took into account only the ten most costly (in terms of lives or dollars) events for each outcome.

Data Processing.

Load the data.

stormData <- read.csv("stormData.csv", header=TRUE)

Reduce dataset to specific consequences.

  1. Select variables of interest, i.e. those that indicate economic consequences or harm to population health.
  2. Convert dates to year only.
  3. Normalize some variable names
modStormData <- stormData[,c("BGN_DATE", "EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "CROPDMG")]
modStormData$BGN_DATE <- format(as.Date(modStormData$BGN_DATE, "%m/%d/%Y"), "%Y")
modStormData$EVTYPE <- gsub("^MARINE TSTM WIND$", "MARINE THUNDERSTORM WIND", modStormData$EVTYPE)
modStormData$EVTYPE <- gsub("^TSTM WIND$", "THUNDERSTORM WIND", modStormData$EVTYPE)

Aggregate data according to the different outcomes and store the ten highest for each.

aggFatalities <- aggregate(modStormData$FATALITIES,
                           by=list(modStormData$EVTYPE), FUN=sum, na.rm=TRUE)
colnames(aggFatalities) = c("eventType", "totalFatalities")
sortFatalities <- aggFatalities[order(-aggFatalities$totalFatalities),]
topFatalities <- sortFatalities[1:10,]

aggInjuries <- aggregate(modStormData$INJURIES,
                           by=list(modStormData$EVTYPE), FUN=sum, na.rm=TRUE)
colnames(aggInjuries) = c("eventType", "totalInjuries")
sortInjuries <- aggInjuries[order(-aggInjuries$totalInjuries),]
topInjuries <- sortInjuries[1:10,]

aggPropertyDamage <- aggregate(modStormData$PROPDMG,
                           by=list(modStormData$EVTYPE), FUN=sum, na.rm=TRUE)
colnames(aggPropertyDamage) = c("eventType", "totalPropertyDamage")
sortPropertyDamage <- aggPropertyDamage[order(-aggPropertyDamage$totalPropertyDamage),]
topPropertyDamage <- sortPropertyDamage[1:10,]

aggCropDamage <- aggregate(modStormData$CROPDMG,
                           by=list(modStormData$EVTYPE), FUN=sum, na.rm=TRUE)
colnames(aggCropDamage) = c("eventType", "totalCropDamage")
sortCropDamage <- aggCropDamage[order(-aggCropDamage$totalCropDamage),]
topCropDamage <- sortCropDamage[1:10,]

Results.

library(ggplot2)

p1 <- ggplot(data=topPropertyDamage, aes(x=eventType, y=totalPropertyDamage)) +
  geom_bar(stat="identity") + xlab("Event Type") + ylab("Total Property Damage") +
  ggtitle("Property Damage by Event Type") +
  theme(axis.text.x=element_text(angle=45, hjust=1))

p2 <- ggplot(data=topCropDamage, aes(x=eventType, y=totalCropDamage)) +
  geom_bar(stat="identity") + xlab("Event Type") + ylab("Total Crop Damage") +
  ggtitle("Crop Damage by Event Type") +
  theme(axis.text.x=element_text(angle=45, hjust=1))

p3 <- ggplot(data=topFatalities, aes(x=eventType, y=totalFatalities)) +
  geom_bar(stat="identity") + xlab("Event Type") + ylab("Total Fatalities") +
  ggtitle("Fatalities by Event Type") +
  theme(axis.text.x=element_text(angle=45, hjust=1))

p4 <- ggplot(data=topInjuries, aes(x=eventType, y=totalInjuries)) +
  geom_bar(stat="identity") + xlab("Event Type") + ylab("Total Injuries") +
  ggtitle("Injuries by Event Type") +
  theme(axis.text.x=element_text(angle=45, hjust=1))

library(gridExtra)
## Warning: package 'gridExtra' was built under R version 3.3.1
grid.arrange(p1,p2,p3,p4, ncol=2)