The main purpose of this analysis is to make a comparison between consequences of different weather events. There are two types of negative impacts. The first one is population health which can be estimated by the number of fatalities and injured people. The second one is the immediate economic impact which based on property and crop damage in dollars.

Data processing

Data was taken from National Weather Service Storm Data. Documentation can be found on Documentation The events in the database start in the year 1950 and end in November 2011. In the earlier years of the database there are generally fewer events recorded, most likely due to a lack of good records. More recent years should be considered more complete.

require(data.table)
require(ggplot2)
dataRaw <- read.csv("repdata-data-StormData.csv.bz2", stringsAsFactors=FALSE)
data <- as.data.table(dataRaw)

Group, sum and order first 20 of most harmful event types with respect to population health.

fatalitiesHarm<- data[,.(fatalities=sum(FATALITIES)), by=EVTYPE][order(-fatalities)][1:20,]
injuriesHarm<- data[,.(injuries=sum(INJURIES)), by=EVTYPE][order(-injuries)][1:20,]

Group, sum and order first 20 Analyse of the most economic consequences event types.

eImpact <- data[,.(damage=sum(PROPDMG + CROPDMG)), by=EVTYPE][order(-damage)][1:20]

Results

ggplot(fatalitiesHarm, aes(reorder(EVTYPE, fatalities), fatalities, fill=fatalities))+geom_bar(stat="identity") + coord_flip() + xlab("Event Type") + ggtitle("Top 20 events which have the worst fatalities")

ggplot(injuriesHarm, aes(reorder(EVTYPE, injuries), injuries, fill=injuries))+geom_bar(stat="identity") + coord_flip() + xlab("Event Type")+ggtitle("Top 20 events which have the worst injuries")

ggplot(eImpact, aes(reorder(EVTYPE, damage), damage, fill=damage))+geom_bar(stat="identity") + coord_flip() + xlab("Event Type")+ggtitle("Top 20 events which have the worst economic impact")

In all 3 cases tornado is the worst type of health and economic.