Storms and other severe weather events can cause both public health and economic problems for communities and municipalities. Many severe events can result in fatalities, injuries, and property damage, and preventing such outcomes to the extent possible is a key concern.

Data Processing

Load the data and normalize the event type column

library(dplyr)
data = read.csv("repdata-data-StormData.csv")
data$EVTYPE <- tolower(data$EVTYPE)

Group the data by event type and calcualte the sum of the fatalities and injuries for each event type

eventdata <- group_by(data, EVTYPE)
healthdata <- summarize(eventdata, fsum=sum(FATALITIES, na.rm=TRUE), isum=sum(INJURIES, na.rm=TRUE))
fevent <- healthdata[order(healthdata$fsum, decreasing=TRUE),]
ievent <- healthdata[order(healthdata$isum, decreasing=TRUE),]

Convert the property damage data into dollar amount, group the data by event type and calcualte the sum of the property damage data for each event type

data$PROPDMGEXP <- as.character(data$PROPDMGEXP)
data$PROPDMG <- as.numeric(data$PROPDMG)
data$PROPDMG[data$PROPDMGEXP=="1"] <- data$PROPDMG[data$PROPDMGEXP=="1"]*(10^1)
data$PROPDMG[data$PROPDMGEXP=="2"] <- data$PROPDMG[data$PROPDMGEXP=="2"]*(10^2)
data$PROPDMG[data$PROPDMGEXP=="3"] <- data$PROPDMG[data$PROPDMGEXP=="3"]*(10^3)
data$PROPDMG[data$PROPDMGEXP=="4"] <- data$PROPDMG[data$PROPDMGEXP=="4"]*(10^4)
data$PROPDMG[data$PROPDMGEXP=="5"] <- data$PROPDMG[data$PROPDMGEXP=="5"]*(10^5)
data$PROPDMG[data$PROPDMGEXP=="6"] <- data$PROPDMG[data$PROPDMGEXP=="6"]*(10^6)
data$PROPDMG[data$PROPDMGEXP=="7"] <- data$PROPDMG[data$PROPDMGEXP=="7"]*(10^7)
data$PROPDMG[data$PROPDMGEXP=="8"] <- data$PROPDMG[data$PROPDMGEXP=="8"]*(10^8)
data$PROPDMG[data$PROPDMGEXP=="B"] <- data$PROPDMG[data$PROPDMGEXP=="B"]*(10^9)
data$PROPDMG[data$PROPDMGEXP=="h"] <- data$PROPDMG[data$PROPDMGEXP=="h"]*(10^2)
data$PROPDMG[data$PROPDMGEXP=="H"] <- data$PROPDMG[data$PROPDMGEXP=="H"]*(10^2)
data$PROPDMG[data$PROPDMGEXP=="K"] <- data$PROPDMG[data$PROPDMGEXP=="K"]*(10^3)
data$PROPDMG[data$PROPDMGEXP=="m"] <- data$PROPDMG[data$PROPDMGEXP=="m"]*(10^6)
data$PROPDMG[data$PROPDMGEXP=="M"] <- data$PROPDMG[data$PROPDMGEXP=="M"]*(10^6)
eventdata <- group_by(data, EVTYPE)
economicdata <- summarize(eventdata, esum=sum(PROPDMG, na.rm=TRUE))
eevent <- economicdata[order(economicdata$esum, decreasing=TRUE),]

Results

The top 10 event types that are most harmful with respect to fatalities

head(fevent, 10)
## Source: local data frame [10 x 3]
## 
##            EVTYPE fsum  isum
## 1         tornado 5633 91346
## 2  excessive heat 1903  6525
## 3     flash flood  978  1777
## 4            heat  937  2100
## 5       lightning  816  5230
## 6       tstm wind  504  6957
## 7           flood  470  6789
## 8     rip current  368   232
## 9       high wind  248  1137
## 10      avalanche  224   170

The top 10 event types that are most harmful with respect to injuries

head(ievent, 10)
## Source: local data frame [10 x 3]
## 
##               EVTYPE fsum  isum
## 1            tornado 5633 91346
## 2          tstm wind  504  6957
## 3              flood  470  6789
## 4     excessive heat 1903  6525
## 5          lightning  816  5230
## 6               heat  937  2100
## 7          ice storm   89  1975
## 8        flash flood  978  1777
## 9  thunderstorm wind  133  1488
## 10              hail   15  1361

The top 10 event types that have the greatest economic impact

head(eevent, 10)
## Source: local data frame [10 x 2]
## 
##               EVTYPE         esum
## 1              flood 144657709807
## 2  hurricane/typhoon  69305840000
## 3            tornado  56947380676
## 4        storm surge  43323536000
## 5        flash flood  16822673978
## 6               hail  15735267513
## 7          hurricane  11868319010
## 8     tropical storm   7703890550
## 9       winter storm   6688497251
## 10         high wind   5270046295
figure <- barplot(eevent$esum[1:10], ylab="Economic Impact")
axis(1, at=figure, labels=eevent$EVTYPE[1:10], las=2)