Natural calamities like floods, hurricanes, even extreme heat, etc can wreak havoc on the lives of people and also damage property and crops. They can disrupt life for quite some time before normalcy is restored. In this analysis, the economic and health impact of such events is quantified using the given dataset. The top most damaging events are found out, so that mitigation strategies can be planned in advance.
# Setting strigsasfactors to false
data = read.csv('repdata_data_StormData.csv', stringsAsFactors= FALSE)
str(data)
## 'data.frame': 902297 obs. of 37 variables:
## $ STATE__ : num 1 1 1 1 1 1 1 1 1 1 ...
## $ BGN_DATE : chr "4/18/1950 0:00:00" "4/18/1950 0:00:00" "2/20/1951 0:00:00" "6/8/1951 0:00:00" ...
## $ BGN_TIME : chr "0130" "0145" "1600" "0900" ...
## $ TIME_ZONE : chr "CST" "CST" "CST" "CST" ...
## $ COUNTY : num 97 3 57 89 43 77 9 123 125 57 ...
## $ COUNTYNAME: chr "MOBILE" "BALDWIN" "FAYETTE" "MADISON" ...
## $ STATE : chr "AL" "AL" "AL" "AL" ...
## $ EVTYPE : chr "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
## $ BGN_RANGE : num 0 0 0 0 0 0 0 0 0 0 ...
## $ BGN_AZI : chr "" "" "" "" ...
## $ BGN_LOCATI: chr "" "" "" "" ...
## $ END_DATE : chr "" "" "" "" ...
## $ END_TIME : chr "" "" "" "" ...
## $ COUNTY_END: num 0 0 0 0 0 0 0 0 0 0 ...
## $ COUNTYENDN: logi NA NA NA NA NA NA ...
## $ END_RANGE : num 0 0 0 0 0 0 0 0 0 0 ...
## $ END_AZI : chr "" "" "" "" ...
## $ END_LOCATI: chr "" "" "" "" ...
## $ LENGTH : num 14 2 0.1 0 0 1.5 1.5 0 3.3 2.3 ...
## $ WIDTH : num 100 150 123 100 150 177 33 33 100 100 ...
## $ F : int 3 2 2 2 2 2 2 1 3 3 ...
## $ MAG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ FATALITIES: num 0 0 0 0 0 0 0 0 1 0 ...
## $ INJURIES : num 15 0 2 2 2 6 1 0 14 0 ...
## $ PROPDMG : num 25 2.5 25 2.5 2.5 2.5 2.5 2.5 25 25 ...
## $ PROPDMGEXP: chr "K" "K" "K" "K" ...
## $ CROPDMG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ CROPDMGEXP: chr "" "" "" "" ...
## $ WFO : chr "" "" "" "" ...
## $ STATEOFFIC: chr "" "" "" "" ...
## $ ZONENAMES : chr "" "" "" "" ...
## $ LATITUDE : num 3040 3042 3340 3458 3412 ...
## $ LONGITUDE : num 8812 8755 8742 8626 8642 ...
## $ LATITUDE_E: num 3051 0 0 0 0 ...
## $ LONGITUDE_: num 8806 0 0 0 0 ...
## $ REMARKS : chr "" "" "" "" ...
## $ REFNUM : num 1 2 3 4 5 6 7 8 9 10 ...
# New variable ploss is defined as the sum of fatalities and injuries
data$ploss= data$FATALITIES+ data$INJURIES
# Aggregating ploss wrt EVTYPE
health= aggregate(ploss~EVTYPE, data=data, FUN = sum)
health = health[order(health$ploss,decreasing = T), ]
d= as.data.frame(head(health, 10))
d
## EVTYPE ploss
## 834 TORNADO 96979
## 130 EXCESSIVE HEAT 8428
## 856 TSTM WIND 7461
## 170 FLOOD 7259
## 464 LIGHTNING 6046
## 275 HEAT 3037
## 153 FLASH FLOOD 2755
## 427 ICE STORM 2064
## 760 THUNDERSTORM WIND 1621
## 972 WINTER STORM 1527
# Top 10 most damaging events are plotted in a bar plot
barplot(d$ploss[1:10], names.arg= c(d$EVTYPE[1:10]),
col = 'steelblue', main='10 Events Most Damaging to Health',
ylim = c(0,100000), las=2, cex.names = .6)
# Defining a function for multiplying damage and damagexp columns
multiplier = function(x,y){
if (y=='K') {multiplier= x*1000}
else if (y== 'M') {multiplier= x*1000000}
else if (y== 'B') {multiplier= x*1000000000}
else {multiplier= x}
multiplier
}
# New variable is defined which captures the total damage from crop and property
data$damg = mapply(multiplier, data$PROPDMG, data$PROPDMGEXP)+
mapply(multiplier, data$CROPDMG, data$CROPDMGEXP)
# Aggregating damg wrt EVTYPE
eco= aggregate(damg~EVTYPE, data=data, FUN = sum)
eco = eco[order(eco$damg,decreasing = T), ]
head(eco ,10)
## EVTYPE damg
## 170 FLOOD 150319678257
## 411 HURRICANE/TYPHOON 71913712800
## 834 TORNADO 57340614060
## 670 STORM SURGE 43323541000
## 244 HAIL 18752904943
## 153 FLASH FLOOD 17562129167
## 95 DROUGHT 15018672000
## 402 HURRICANE 14610229010
## 590 RIVER FLOOD 10148404500
## 427 ICE STORM 8967041360
barplot(eco$damg[1:10], names.arg = c(eco$EVTYPE[1:10]), col = 'steelblue',
main='10 Most economically damaging events', las=2, cex.names = .6)
The 10 most damaging events wrt population health were as follows:
Tornado, Excessive Heat, TSTM Wind, Flood, Lightning, Heat, Flash Flood, Ice Storm, Thunderstorm wind, and winter storm.
The 10 most damaging events wrt economic impact were as follows:
Flood, Typhoon, Tornado, Storm Surge, Hail, Flash Flood, Drought, Hurricane, River Flood and Ice storm.
Overall, tornado, flood, flash flood and ice storm are common to both these lists, and hence, can be said to be the most devastating.