Analysis is based on the Storm Data.csv file provided by the National Weather Service (NWs).Only the weather events defined in Table 1 of the NWS Documentation (Instruction 10-1605) are used, all other events are discarded. The most harmful event with respect to population health is defined as an event with the most total fatalities. Events with the highest combined property damage (PROPDMG) are considered to be the events with the greatest economic consequences. The top five most harmful and economically devastating events are identified and presented in the tabular and graphical formats.
| EVENT |
|---|
| ASTRONOMICAL LOW TIDE |
| AVALANCHE |
| BLIZZARD |
| COASTAL FLOOD |
| COLD/WIND CHILL |
| DEBRIS FLOW |
| DENSE FOG |
| DENSE SMOKE |
| DROUGHT |
| DUST DEVIL |
| DUST STORM |
| EXCESSIVE HEAT |
| EXTREME COLD/WIND CHILL |
| FLASH FLOOD |
| FLOOD |
| FROST/FREEZE |
| FUNNEL CLOUD |
| FREEZING FOG |
| HAIL |
| HEAT |
| HEAVY RAIN |
| HEAVY SNOW |
| HIGH SURF |
| HIGH WIND |
| MARINE HAIL |
| MARINE HIGH WIND |
| MARINE STRONG WIND |
| MARINE THUNDERSTORM WIND |
| RIP CURRENT |
| SEICHE |
| SLEET |
| STORM SURGE/TIDE |
| STRONG WIND |
| THUNDERSTORM WIND |
| TORNADO |
| TROPICAL DEPRESSION |
| TROPICAL STORM |
| TSUNAMI |
| VOLCANIC ASH |
| WATERSPOUT |
| WILDFIRE |
| WINTER STORM |
| WINTER WEATHER |
Remove events not specified in Table 1 (Instruction 10-1605)
inTable1 <-stormData$EVTYPE %in% eventsList$EVENT
subStormData <- stormData[which(inTable1 == TRUE),]
Calculate total fatalities and economic impact for each weather event, sort results in decreasing order.
splitSubStormData <- split(subStormData,subStormData$EVTYPE)
fatalities <- c()
properyDamage <- c()
for (i in 1:(nrow(eventsList)-1)) {
fatalities[i] <- sum(as.numeric(splitSubStormData[[i]]$FATALITIES))
properyDamage[i] <- sum(as.numeric(splitSubStormData[[i]]$PROPDMG))
}
results <- data.frame(eventsList[2:43,],fatalities,properyDamage)
names(results) <- c("Event", "Fatalities", "Propery Damage")
R1 <- results[order(results$Fatalities,decreasing = TRUE),]
R2 <- results[order(results$`Propery Damage`,decreasing = TRUE),]
## [1] "The most harmful event is TORNADO with total fatalities 5633."
## [1] "The events with the greatest economic consequences is TORNADO with total property loss 3212258.16."
Table A : Top 5 most harmful weather events
knitr::kable(head(R1[,c(1,2)]),row.names=FALSE, format = "markdown")
| Event | Fatalities |
|---|---|
| TORNADO | 5633 |
| EXCESSIVE HEAT | 1903 |
| FLASH FLOOD | 978 |
| HEAT | 937 |
| FLOOD | 470 |
| RIP CURRENT | 368 |
Table B : Top 5 most economically devastating weather events
knitr::kable(head(R2[,c(1,3)]),row.names=FALSE, format = "markdown")
| Event | Propery Damage |
|---|---|
| TORNADO | 3212258.2 |
| FLASH FLOOD | 1420124.6 |
| FLOOD | 899938.5 |
| THUNDERSTORM WIND | 876844.2 |
| HAIL | 688693.4 |
| HIGH WIND | 324731.6 |
Graphical representation of table results.
barplot(height=R1$Fatalities[1:5],names.arg = R1$Event[1:5], horiz = TRUE, las = 1,
xlab = "Fatalities", main = "Most harmful events",
cex.names = 0.7, col = "yellow")
barplot(height=R2$`Propery Damage`[1:5],names.arg = R2$Event[1:5], horiz = TRUE, las = 1,
xlab = "Property loss", main = "Events with greatest economic consequences",
cex.names = 0.7, col = "red")