This report analyzes the impact of natural disasters on population health and the economy. the top ten natural disasters that have the greatest impact on population health and the economy are respectively presented in the form of charts. Among them, TORNADO has the greatest impact on population health, and FLOOD has the greatest impact on economy.
At first, we install all data and make a quick check
data = read.csv(bzfile("C:/Users/lenovo/Desktop/repdata_data_StormData.csv.bz2"))
dim(data)
## [1] 902297 37
head(data)
## STATE__ BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE EVTYPE
## 1 1 4/18/1950 0:00:00 0130 CST 97 MOBILE AL TORNADO
## 2 1 4/18/1950 0:00:00 0145 CST 3 BALDWIN AL TORNADO
## 3 1 2/20/1951 0:00:00 1600 CST 57 FAYETTE AL TORNADO
## 4 1 6/8/1951 0:00:00 0900 CST 89 MADISON AL TORNADO
## 5 1 11/15/1951 0:00:00 1500 CST 43 CULLMAN AL TORNADO
## 6 1 11/15/1951 0:00:00 2000 CST 77 LAUDERDALE AL TORNADO
## BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END COUNTYENDN
## 1 0 0 NA
## 2 0 0 NA
## 3 0 0 NA
## 4 0 0 NA
## 5 0 0 NA
## 6 0 0 NA
## END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES INJURIES PROPDMG
## 1 0 14.0 100 3 0 0 15 25.0
## 2 0 2.0 150 2 0 0 0 2.5
## 3 0 0.1 123 2 0 0 2 25.0
## 4 0 0.0 100 2 0 0 2 2.5
## 5 0 0.0 150 2 0 0 2 2.5
## 6 0 1.5 177 2 0 0 6 2.5
## PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES LATITUDE LONGITUDE
## 1 K 0 3040 8812
## 2 K 0 3042 8755
## 3 K 0 3340 8742
## 4 K 0 3458 8626
## 5 K 0 3412 8642
## 6 K 0 3450 8748
## LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1 3051 8806 1
## 2 0 0 2
## 3 0 0 3
## 4 0 0 4
## 5 0 0 5
## 6 0 0 6
names(data)
## [1] "STATE__" "BGN_DATE" "BGN_TIME" "TIME_ZONE" "COUNTY"
## [6] "COUNTYNAME" "STATE" "EVTYPE" "BGN_RANGE" "BGN_AZI"
## [11] "BGN_LOCATI" "END_DATE" "END_TIME" "COUNTY_END" "COUNTYENDN"
## [16] "END_RANGE" "END_AZI" "END_LOCATI" "LENGTH" "WIDTH"
## [21] "F" "MAG" "FATALITIES" "INJURIES" "PROPDMG"
## [26] "PROPDMGEXP" "CROPDMG" "CROPDMGEXP" "WFO" "STATEOFFIC"
## [31] "ZONENAMES" "LATITUDE" "LONGITUDE" "LATITUDE_E" "LONGITUDE_"
## [36] "REMARKS" "REFNUM"
According to the National Weather Service Storm Data
Documentation, FATALITIES and INJURIES correspond respectively to
population health. Therefore, these two items and the EVTYPE item are
taken out separately by function aggregate() to form a new
dataset: health.
Sort health according to the total number of affected
people
health = aggregate(cbind(FATALITIES, INJURIES) ~ EVTYPE,
data = data,
sum)
health$total = health$FATALITIES + health$INJURIES
health = health[order(health$total, decreasing = TRUE), ]
head(health, 10)
## EVTYPE FATALITIES INJURIES total
## 834 TORNADO 5633 91346 96979
## 130 EXCESSIVE HEAT 1903 6525 8428
## 856 TSTM WIND 504 6957 7461
## 170 FLOOD 470 6789 7259
## 464 LIGHTNING 816 5230 6046
## 275 HEAT 937 2100 3037
## 153 FLASH FLOOD 978 1777 2755
## 427 ICE STORM 89 1975 2064
## 760 THUNDERSTORM WIND 133 1488 1621
## 972 WINTER STORM 206 1321 1527
Extract the first ten items from the health dataset for
plotting.
Because of the large number of INJURIES, an additional image related
only to FATALITIES is drawn.
top10 = head(health, 10)
par(mfcol = c(1,2))
barplot(t(as.matrix(top10[, c("FATALITIES", "INJURIES")])),
names.arg = top10$EVTYPE,
las = 2,
main = "Top 10 Events by Population Health Impact",
ylab = "Fatalities + Injuries",
col = c("red", "blue"))
barplot(top10$FATALITIES,
names.arg = top10$EVTYPE,
las = 2,
main = "Top 10 Events by Population Health Impact",
ylab = "Fatalities",
col = 'red')
According to the National Weather Service Storm Data
Documentation, PROPDMG and CROPDMG correspond respectively to the
economic consequences, and PROPDMGEXP and CROPDMGEXP are unit for
PROPDMG and CROPDMG. Therefore, we did three steps:
1. merge PROPDMG and PROPDMGEXP to new column: PROPDMG_actual, CROPDMG
and CROPDMGEXP to CROPDMG_actual
2. PROPDMG_actual, CROPDMG_actual and EVTYPE column are taken out
separately to form a new dataset: damage. 3. Sort
damage according to the total number of affected people
data$PROPDMG_actual = data$PROPDMG
data$PROPDMG_actual[data$PROPDMGEXP == "K"] = data$PROPDMG[data$PROPDMGEXP == "K"] * 10^3
data$PROPDMG_actual[data$PROPDMGEXP == "M"] = data$PROPDMG[data$PROPDMGEXP == "M"] * 10^6
data$PROPDMG_actual[data$PROPDMGEXP == "B"] = data$PROPDMG[data$PROPDMGEXP == "B"] * 10^9
data$CROPDMG_actual = data$CROPDMG
data$CROPDMG_actual[data$CROPDMGEXP == "K"] = data$CROPDMG[data$CROPDMGEXP == "K"] * 10^3
data$CROPDMG_actual[data$CROPDMGEXP == "M"] = data$CROPDMG[data$CROPDMGEXP == "M"] * 10^6
data$CROPDMG_actual[data$CROPDMGEXP == "B"] = data$CROPDMG[data$CROPDMGEXP == "B"] * 10^9
damage = aggregate(cbind(PROPDMG_actual, CROPDMG_actual) ~ EVTYPE,
data = data,
sum)
damage$total = damage$PROPDMG_actual + damage$CROPDMG_actual
damage = damage[order(damage$total, decreasing = TRUE), ]
head(damage, 10)
## EVTYPE PROPDMG_actual CROPDMG_actual total
## 170 FLOOD 144657709807 5661968450 150319678257
## 411 HURRICANE/TYPHOON 69305840000 2607872800 71913712800
## 834 TORNADO 56925660790 414953270 57340614060
## 670 STORM SURGE 43323536000 5000 43323541000
## 244 HAIL 15727367053 3025537890 18752904943
## 153 FLASH FLOOD 16140812067 1421317100 17562129167
## 95 DROUGHT 1046106000 13972566000 15018672000
## 402 HURRICANE 11868319010 2741910000 14610229010
## 590 RIVER FLOOD 5118945500 5029459000 10148404500
## 427 ICE STORM 3944927860 5022113500 8967041360
Extract the first ten items from the damage dataset for
plotting.
top10_damage = head(damage, 10)
par(mfcol = c(1,1))
barplot(t(as.matrix(top10_damage[, c("PROPDMG_actual",
"CROPDMG_actual")])),
names.arg = top10_damage$EVTYPE,
las = 2,
main = "Top 10 Events by Economic Consequences",
ylab = "Economic Damage ($)",
col = c("red", "blue"))
By analyzing the data, it can be seen that the top ten events that pose the greatest threat to human health are TORNADO, EXCESSIVE HEAT, TSTM WIND, FLOOD, LIGHTNING, HEAT, FLASH FLOOD, ICE STORM. WIND, WINTER STORM. Among them, TORNADO had the greatest impact, affecting a total of 96,979 people, including 5,633 deaths and 91,346 injuries.
The top ten events that have the greatest impact on the economy are FLOOD, HURRICANE/TYPHOON, TORNADO, STORM SURGE, HAIL, FLASH FLOOD, DROUGHT, HURRICANE, RIVER FLOOD and ICE STORM. Among them, FLOOD had the greatest impact, with a total loss of 150,319,678,257, of which 144,657,709,807 were property losses and 566,1968,450 were crop losses.