Summary

In this assigment the data of the storm events in USA is going be analyzed to decide where to invest resources for each of the different possible events. The data will focus in two aspects of the data. It will start with the analysis of the harm to the population considering the effect on the health of the people and then, the economic effects of the events will be analyzed as well.

Data Transformations

Reading the data

The data is read directly from the compressed bz2 file.

StormData <- read.csv("repdata_data_StormData.csv.bz2")

A first evaluation of the data, we can see that there’s a high number of events according to the dimensions of the data = 902297, 37 including a high number of different events types of 985.

Transforming the data

We will create a sum of the data related to the health, the deaths and injured. The data will contain the 10 most important Events.

StormFat <- tapply(StormData$FATALITIES, StormData$EVTYPE, sum)
StormFatTop10 <- StormFat[order(StormFat, decreasing = TRUE)][1:10]
StormInj <- tapply(StormData$INJURIES, StormData$EVTYPE, sum)
StormInjTop10 <- StormInj[order(StormInj, decreasing = TRUE)][1:10]

For the economic consequences a similar calculation will be done in a similar way reading the property damage (PROPDMG)

StormPropDmg <- tapply(StormData$PROPDMG, StormData$EVTYPE, sum)
StormPropDmgTop10 <- StormFat[order(StormPropDmg, decreasing = TRUE)][1:10]
StormCropDmg <- tapply(StormData$CROPDMG, StormData$EVTYPE, sum)
StormCropDmgTop10 <- StormFat[order(StormCropDmg, decreasing = TRUE)][1:10]

Results

The following Plot shows the most health related harmful events.

par(mfcol = c(1,2), mar = c(7,4,4,1))
plot(StormFatTop10, xaxt = "n", xlab = "", ylab = "Total Fatalities")
axis(1, at=1:10, names(StormFatTop10), las = 2, pch = 5)
plot(StormInjTop10, xaxt = "n", xlab = "", ylab = "Total Injuries")
axis(1, at=1:10, names(StormInjTop10), las = 2, pch = 5)
mtext("Health harm per Event", side = 3, line = -2, outer = TRUE, cex = 1.5)

The conclusion is that clearly, the tornados are the worst event with a huge different compared to the seconf one.

The following plot compares the economic effects.

par(mfcol = c(1,2), mar = c(7,4,4,1))
plot(StormPropDmgTop10, xaxt = "n", xlab = "", ylab = "Prop Damage")
axis(1, at=1:10, names(StormPropDmgTop10), las = 2, pch = 5)
plot(StormCropDmgTop10, xaxt = "n", xlab = "", ylab = "Crop Damage")
axis(1, at=1:10, names(StormCropDmgTop10), las = 2, pch = 5)
mtext("Economic impact per Event", side = 3, line = -2, outer = TRUE, cex = 1.5)

We can conclude that the tornados are the event that produces more economic loss.