In this report, we aim to find the weather events that have the worst impacts on public health and on the economy. We determine an events impact on public health as the aggregate sum of injuries and fatalities and the impact on the economy as the aggregate sum of crop and property damage. In both cases, the weather event that causes the most damage are tornadoes.
The weather events that cause the most damage to the economy are floods, thunderstorm winds, hail, lightning, high winds, and winter storms.
The weather events that are most dangerous to public health are excessive heat, thunderstorm wind, floods, lighting, ice storms, and winter storms.
Here we will read in the data and complete any other preprocessing.
library(data.table)
library(ggplot2)
storm_data <- fread("repdata_data_StormData.csv.bz2")
head(storm_data)
Next, we will clean up the EVTYPE column in this data. There is some clear overlap in some of the EVTYPE entries that can be at least partially addressed fairly easily.
clean_evtype <- toupper(storm_data$EVTYPE)
clean_evtype <- gsub("[[:blank:][:punct:]+]", " ", clean_evtype)
And then check that EVTYPE has been condensed and replace it.
length(unique(storm_data$EVTYPE))
## [1] 985
length(unique(clean_evtype))
## [1] 874
storm_data$EVTYPE <- clean_evtype
To get an idea of of the event types that are the most devastating to public health, we will aggregate fatalities and injuries by the various events.
injuries <- aggregate(INJURIES ~ EVTYPE, data = storm_data, sum)
fatalities <- aggregate(FATALITIES ~ EVTYPE, data = storm_data, sum)
Now that we have aggregated the injuries and deaths for each event type, we will now add those numbers together to get a measure of the damage to public health caused by each event over this period. We will look at the ten most dangerous events based on this measure to see which have the largest impact on public health.
health <- as.data.table(merge(injuries, fatalities))
health[, INJ_FATAL := INJURIES + FATALITIES]
health <- health[order(health$INJ_FATAL, decreasing = T), ][1:10]
health
The figure below shows the ten storm events that have the largest effect on public health.
The weather event that has the largest effect on public health is clearly tornadoes. The other most dangerous events are excessive heat, thunderstorm wind, floods, lighting, ice storms, and winter storms.
We will follow a similar strategy to determine the weather events that cause the most economic damage. We will begin by aggregating crop and property damage by the various event types.
crop_dmg <- aggregate(CROPDMG ~ EVTYPE, data = storm_data, sum)
property_dmg <- aggregate(PROPDMG ~ EVTYPE, data = storm_data, sum)
Now that the damages have been aggregated, we will add the crop and property damages together for each event type to get a measure of total economic damage. We will look at the ten events that caused the most damage over this period.
eco_damage <- as.data.table(merge(crop_dmg, property_dmg))
eco_damage[, tot_damage := CROPDMG + PROPDMG]
eco_damage <- eco_damage[order(eco_damage$tot_damage, decreasing = T), ][1:10]
eco_damage
The figure below shows the ten storm events that have the largest impact on the economy based on damage to crops and property. The weather events that cause the most damage to the economy are tornadoes, floods, thunderstorm winds, hail, lightning, high winds, and winter storms.