synopsis

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. In this report, we investigate two major questions: which types of events are most harmful to population health and which types of events have the greatest economic consequences.
All data processing and analysis and the code of that are provided.

Data Processing

The following code describes how the data is downloaded and processed.

## read in the data
data=read.csv(bzfile("repdata_data_StormData.csv.bz2","rt"),header=TRUE)

Results

This part, I mainly focus on two questions:
-which types of events are most harmful to population health?
-which types of events have the greatest economic consequences?

So, first I investigate the question about population health.

events<-data$EVTYPE
injury<-data$INJURIES
death<-data$FATALITIES
subdata<-data.frame(events,injury,death)
##calculate the average injury and fatalities.
typeOfEvents<-levels(events)
aveInjury<-NA
aveDeath<-NA
for(i in 1:length(typeOfEvents)){
  aveInjury[i]<-mean(subdata$injury[subdata$events==typeOfEvents[i]],na.rm=TRUE)
  aveDeath[i]<-mean(subdata$death[subdata$events==typeOfEvents[i]],na.rm=TRUE)
}

dealedData<-data.frame(typeOfEvents,aveInjury,aveDeath)

##remove zero data
subdealedData<-dealedData[dealedData$aveInjury!=0 & dealedData$aveDeath!=0,]
topInjury<-subdealedData[order(subdealedData$aveInjury,decreasing=TRUE),]
topDeath<-subdealedData[order(subdealedData$aveDeath,decreasing=TRUE),]
library("ggplot2")
qplot(typeOfEvents,aveInjury,data=topInjury[1:10,],geom="bar",stat="identity",main="Top Ten Injury Events",xlab="Events Type",ylab="Average Injury Rate")+theme(axis.text.x=element_text(angle = 90,hjust = 1))

qplot(typeOfEvents,aveDeath,data=topDeath[1:10,],geom="bar",stat="identity",main="Top Ten Death Events",xlab="Events Type",ylab="Average Death Rate")+theme(axis.text.x=element_text(angle = 90,hjust = 1))

From the plot above we could tell that TROPICAL STORM GORDON is the most harmful event for human health.

Then, let’s jump to the second question: which types of events have the greatest economic consequences?

PROPDMG<-data$PROPDMG
CROPDMG<-data$CROPDMG
total<-PROPDMG+CROPDMG
subdata2<-data.frame(events,PROPDMG,CROPDMG,total)
totalLose<-NA
for(i in 1:length(typeOfEvents)){
  totalLose[i]<-sum(subdata2$total[subdata2$events==typeOfEvents[i]]) 
}
dealedData2<-data.frame(typeOfEvents,totalLose)
top<-dealedData2[order(dealedData2$totalLose,decreasing=TRUE),]
ggplot(top[1:10,],aes(x = reorder(typeOfEvents,totalLose),y = totalLose)) + geom_bar(stat = "identity") +xlab("Events") + ylab("Damages") + theme(axis.text.x=element_text(angle = 90,hjust = 1)) + ggtitle("Damages Statistics Caused by weather events")

From the plot above we could tell that TORNADO is the most harmful to economic development.