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 document the Storm Data is analysed: an official publication of the National Oceanic and Atmospheric Administration (NOAA). The main objective is to show those events that cause the major human and economical damage in the USA between the year 1950 and end in November 2011.
The following code is for loading the data, available in the repdata_data_StormData.csv.bz2 file. The packages that are used will also be loaded with the library function.
## Warning: package 'plyr' was built under R version 3.5.3
First of all I will split the dataset regarding the harmful events. This includes the amount of people died (fatalities) and the amount of people injured (injuries).
The following are the most harmful events that caused mortalities:
head(fatalities[,c(1,2)])
## EVTYPE fatalities
## 834 TORNADO 5633
## 130 EXCESSIVE HEAT 1903
## 153 FLASH FLOOD 978
## 275 HEAT 937
## 464 LIGHTNING 816
## 856 TSTM WIND 504
The following are the most harmful events that caused injuries:
head(injuries[,c(1,3)])
## EVTYPE injuries
## 834 TORNADO 91346
## 856 TSTM WIND 6957
## 170 FLOOD 6789
## 130 EXCESSIVE HEAT 6525
## 464 LIGHTNING 5230
## 275 HEAT 2100
I will focus in “PROPDMG”, “PROPDMGEXP”, “CROPDMG”, “CROPDMGEXP” variables, which are the variables of property and crop damage. “PROPDMGEXP” and “CROPDMGEXP” contain the exponential value for every one, being “H” for hundreds, “K” for thousands, “M” for millions, and “B” for billions (as it is documented).
The following code generates a dataframe that contains the total cost for every observation in a new variable.
Unifying it by event type:
The following are the events that caused more property economical costs:
head(propCost[c(1,2)])
## EVTYPE propCost
## 170 FLOOD 1.225222e+14
## 411 HURRICANE/TYPHOON 6.550381e+13
## 670 STORM SURGE 4.256076e+13
## 402 HURRICANE 5.706168e+12
## 834 TORNADO 5.351637e+12
## 848 TROPICAL STORM 5.152554e+12
The following are the events that caused more crop economical costs:
head(cropCost[c(1,3)])
## EVTYPE cropCost
## 590 RIVER FLOOD 5.000029e+12
## 427 ICE STORM 5.000022e+12
## 95 DROUGHT 1.512473e+12
## 411 HURRICANE/TYPHOON 1.511098e+12
## 275 HEAT 4.000015e+11
## 192 FREEZE 2.002462e+11
The following graph shows which are the most harmful events for people. In the left graph, those events that most fatalities have caused are represented. In the right graph, the events represent the injuries caused.
fat <- head(fatalities[,c(1,2)])
inj <- head(injuries[,c(1,3)])
par(mfrow=c(1,2))
barplot(fat$fatalities, title="Total fatalities by event type", ylab= "Total", beside=TRUE, col=rainbow(5))
## Warning in plot.window(xlim, ylim, log = log, ...): "title" is not a
## graphical parameter
## Warning in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...):
## "title" is not a graphical parameter
## Warning in axis(if (horiz) 1 else 2, cex.axis = cex.axis, ...): "title" is
## not a graphical parameter
legend("topright", as.character(fat$EVTYPE), cex=0.6, bty="n", fill=rainbow(5))
barplot(inj$injuries, main="Total injuries by event type", ylab= "Total", beside=TRUE, col=rainbow(5))
legend("topright", as.character(inj$EVTYPE), cex=0.6, bty="n", fill=rainbow(5))
The next graph shows the economical damages caused by the events. In the left side the events that caused the higher property damage cost are represented (in dollars), and in the right side those events that caused the higher crop damage cost.
prop <- head(propCost[c(1,2)])
crop <- head(cropCost[c(1,3)])
par(mfrow=c(1,2))
barplot(prop$propCost, title="Total property damage cost (in $) by event", ylab= "Total", beside=TRUE, col=rainbow(5))
## Warning in plot.window(xlim, ylim, log = log, ...): "title" is not a
## graphical parameter
## Warning in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...):
## "title" is not a graphical parameter
## Warning in axis(if (horiz) 1 else 2, cex.axis = cex.axis, ...): "title" is
## not a graphical parameter
legend("topright", as.character(fat$EVTYPE), cex=0.6, bty="n", fill=rainbow(5))
barplot(crop$cropCost, main="Total crop damage cost (in $) by event", ylab= "Total", beside=TRUE, col=rainbow(5))
legend("topright", as.character(inj$EVTYPE), cex=0.6, bty="n", fill=rainbow(5))