In the following analysis, we have shown what NOAA Events cause the most amount of damage in terms of both Population (injuries and fatalities) and Economic (crop and property). We will be utilizing data provided by the U.S. National Oceanic and Atmospheric Administration’s (NOAA) Storm Database. This data measures January 1950 to November 2011.
The resulting analysis found that tornadoes caused both the most Population and Economic damages.
## for plotting
library(ggplot2)
library(gridExtra)
First, read in the data and observe the structure.
storms <- read.csv('repdata_data_StormData.csv.bz2')
str(storms)
## '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 ...
We are interested in answering the question of what types of events
are most harmful with respect to both population and economic
impact.
We will start with the impact on population.
We can see from the variables present in the provided data that population health is measured in both injuries and fatalities, which we will combine into a single variable for ease of use.
## initial variable creation
storms$Pop_Damage <- storms$FATALITIES + storms$INJURIES
After which, we will group by individual Event Type.
## sum this metric by event type.
population_damage <- aggregate(storms$Pop_Damage, by = list(storms$EVTYPE), sum)
## now rename the resulting columns
colnames(population_damage)[1] <- 'EVTYPE'
colnames(population_damage)[2] <- 'Damage'
To get an initial read on the damage sources, we will examine the total
available EVTYPEs in our data.
There are a total of
length(unique(storms$EVTYPE))
## [1] 985
unique disaster types present.
As we can see, there are far too many individual events to display
cleanly on a single chart, so we will limit to the top 10.
## order by damage desc and limit
top_dmg_pop <- population_damage[order(population_damage$Damage, decreasing = T),][1:10,]
## create result plots, will arrange in a grid in the Results section.
bar_pop <- ggplot(data = top_dmg_pop, aes(x = EVTYPE)) + geom_bar(aes(y = Damage),stat = 'identity', fill = '#423f61') + coord_flip()
table_pop <- tableGrob(top_dmg_pop)
We will now complete an analogous measurement for economic damage. Similar to the above analysis, we will start by creating a variable equal to the sum of both Property and Crop damage.
storms$econ_dmg <- storms$CROPDMG + storms$PROPDMG
And group by each EVTYPE.
## aggregate
econ_dmg <- aggregate(storms$econ_dmg, by = list(storms$EVTYPE), sum)
## rename columns for usage.
colnames(econ_dmg)[1] <- 'EVTYPE'
colnames(econ_dmg)[2] <- 'Damage'
The data has not changed, so we will not recount the total number of
EVTYPEs present. Our next step will be to create our plot grid.
## order by damage desc and limit
top_econ_dmg <- econ_dmg[order(econ_dmg$Damage, decreasing = T),][1:10,]
## create result plots, will arrange in a grid in the Results section.
bar_econ <- ggplot(data = top_econ_dmg, aes(x = EVTYPE)) + geom_bar(aes(y = Damage),stat = 'identity', fill = '#81a193') + coord_flip()
table_econ <- tableGrob(top_econ_dmg)
grid.arrange(bar_pop, table_pop, ncol = 2)
As we can see from the bar chart and the table in the single figure
above, tornadoes are the most destructive by a long
shot when it comes to population damage.
grid.arrange(bar_econ, table_econ, ncol = 2)
We again see from the single figure that tornadoes are
the largest cause of damage.