Tornado are the worst by far for people and economically. They are the first responsible for fatalities, injuries, and property damages. Only Crop damages are caused mostly by other events, namelly:
data <- read.csv("~/R/Data/repdata_data_StormData.csv.bz2")
data <- as.tibble(data)
data
## # A tibble: 902,297 x 37
## STATE__ BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE EVTYPE
## <dbl> <fct> <fct> <fct> <dbl> <fct> <fct> <fct>
## 1 1 4/18/19~ 0130 CST 97 MOBILE AL TORNA~
## 2 1 4/18/19~ 0145 CST 3 BALDWIN AL TORNA~
## 3 1 2/20/19~ 1600 CST 57 FAYETTE AL TORNA~
## 4 1 6/8/195~ 0900 CST 89 MADISON AL TORNA~
## 5 1 11/15/1~ 1500 CST 43 CULLMAN AL TORNA~
## 6 1 11/15/1~ 2000 CST 77 LAUDERDALE AL TORNA~
## 7 1 11/16/1~ 0100 CST 9 BLOUNT AL TORNA~
## 8 1 1/22/19~ 0900 CST 123 TALLAPOOSA AL TORNA~
## 9 1 2/13/19~ 2000 CST 125 TUSCALOOSA AL TORNA~
## 10 1 2/13/19~ 2000 CST 57 FAYETTE AL TORNA~
## # ... with 902,287 more rows, and 29 more variables: BGN_RANGE <dbl>,
## # BGN_AZI <fct>, BGN_LOCATI <fct>, END_DATE <fct>, END_TIME <fct>,
## # COUNTY_END <dbl>, COUNTYENDN <lgl>, END_RANGE <dbl>, END_AZI <fct>,
## # END_LOCATI <fct>, LENGTH <dbl>, WIDTH <dbl>, F <int>, MAG <dbl>,
## # FATALITIES <dbl>, INJURIES <dbl>, PROPDMG <dbl>, PROPDMGEXP <fct>,
## # CROPDMG <dbl>, CROPDMGEXP <fct>, WFO <fct>, STATEOFFIC <fct>,
## # ZONENAMES <fct>, LATITUDE <dbl>, LONGITUDE <dbl>, LATITUDE_E <dbl>,
## # LONGITUDE_ <dbl>, REMARKS <fct>, REFNUM <dbl>
Then I aggregate the indicators of health damages by type of event:
aggregate1 <- aggregate(data$FATALITIES, by = list(data$EVTYPE), sum)
aggregate1$Damage.type <- "FATALITIES"
aggregate2 <- aggregate(data$INJURIES, by = list(data$EVTYPE), sum)
aggregate2$Damage.type <- "INJURIES"
bind1 <- rbind(aggregate2,aggregate1)
I losely select the most harmful events as the ones with highest single observation. A more in depth work would consist in first aggregating the damages by event type, then build the associated ranking and finally apply it on my current table. The results are somewhat similar and I save lots of code and time here.
I proceed i the same way to compute economical damages:
aggregate3 <- aggregate(data$CROPDMG, by = list(data$EVTYPE), sum)
aggregate3$Damage.type <- "CROP"
aggregate4 <- aggregate(data$PROPDMG, by = list(data$EVTYPE), sum)
aggregate4$Damage.type <- "PROP"
bind3 <- rbind(aggregate4,aggregate3)
Now I can print the most harmful events for the population (sorted by descending single event damage):
And for the economic damages: