by Megan Williams
Synopsis
Storms and other severe weather events can cause both public health and economic problems for communities and municipalities. Many severe events can result in fatalities, injuries, and property damage, and preventing such outcomes to the extent possible is a key concern.
This document involves exploring the U.S. National Oceanic and Atmospheric Administration's (NOAA) storm database between 1950 and 2011. In general, Tornado is most harmful event with respect to population health and economic problems for communities and municipalities.
This document involves exploring the U.S. National Oceanic and Atmospheric Administration's (NOAA) storm database between 1950 and 2011. This database tracks characteristics of major storms and weather events in the United States, including when and where they occur, as well as estimates of any fatalities, injuries, and property damage. Tornadoes appear to be the most harmful events for communities and municipalities.
Data Processing
Load R packages: Plyr and ggplot2.
library(plyr)
##
## Attaching package: 'plyr'
##
## The following objects are masked from 'package:Hmisc':
##
## is.discrete, summarize
library(ggplot2)
#Retrieve the data file ('repdata_data_StormData.csv.bz2) from: https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2
#Save in working directory as "repdata-data-StormData.txt"
data = read.csv("repdata-data-StormData.txt")
#Initialize mapping variable to convert to real values:
mapping = as.data.frame(cbind(key = c("", "-", "?", "+", "0", "1", "2", "3",
"4", "5", "6", "7", "8", "H", "h", "K", "k", "M", "m", "B", "b"), value = c(1,
0, 0, 0, 1, 10, 100, 1000, 10000, 1e+05, 1e+06, 1e+07, 1e+08, 100, 100,
1000, 1000, 1e+06, 1e+06, 1e+09, 1e+09)))
convert = function(x) {
x = factor(x)
levels(x) <- mapping[mapping$key %in% levels(x), "value"]
x = as.numeric(paste(x))
return(x)
}
#Calculate total injuries & fatalities by event Type.
injury = aggregate(INJURIES ~ EVTYPE, data = data, FUN = sum)
top_10_injury = head(arrange(injury, desc(INJURIES)), n = 10)
fatalities = aggregate(FATALITIES ~ EVTYPE, data = data, FUN = sum)
top_10_fatality <- head(arrange(fatalities, desc(FATALITIES)), n = 10)
data$SUM_INJURY_N_FATALITIES = data$INJURIES + data$FATALITIES
sum_injury_n_fatalities = aggregate(SUM_INJURY_N_FATALITIES ~ EVTYPE, data = data,
FUN = sum)
top_10_sum_injury_n_fatalities = head(arrange(sum_injury_n_fatalities, desc(SUM_INJURY_N_FATALITIES)),
n = 10)
Figure 1: Total Injuries and Fatalities by Event Type
par(mfrow = c(1, 2), mar = c(10, 4, 0.5, 2.5), oma = c(1.5, 2, 1, 1))
barplot(top_10_injury$INJURIES, names.arg = top_10_injury$EVTYPE, ylab = "Injuries",
las = 3, col = "darkolivegreen3")
barplot(top_10_fatality$FATALITIES, names.arg = top_10_fatality$EVTYPE, ylab = "Fatalities",
las = 3, col = "darkolivegreen1")
title(main = "Impacts of Weather Events in Population Health", outer = TRUE)
#Calculate crop and property damage (PROPDMGEXP and CROPDMGEXP) by event type.
data$CROPDMGEXP = convert(data$CROPDMGEXP)
data$CROPDMG_real = data$CROPDMGEXP * data$CROPDMG
cropdmg = aggregate(CROPDMG_real ~ EVTYPE, data = data, FUN = sum)
top_10_cropdmg = head(arrange(cropdmg, desc(CROPDMG_real)), n = 10)
data$PROPDMGEXP = convert(data$PROPDMGEXP)
data$PROPDMG_real = data$PROPDMGEXP * data$PROPDMG
propdmg = aggregate(PROPDMG_real ~ EVTYPE, data = data, FUN = sum)
top_10_propdmg = head(arrange(propdmg, desc(PROPDMG_real)), n = 10)
data$SUM_PROPDMG_N_CROPDMG <- data$PROPDMG_real + data$CROPDMG_real
sum_propdmg_n_cropdmg <- aggregate(SUM_PROPDMG_N_CROPDMG ~ EVTYPE, data = data,
FUN = sum)
top_10_sum_propdmg_n_cropdmg <- head(arrange(sum_propdmg_n_cropdmg, desc(SUM_PROPDMG_N_CROPDMG)),
n = 10)
Figure 2: Crops and Property Damage by Event Type
par(mfrow = c(1, 2), mar = c(10, 4, 0.5, 2.5), oma = c(1.5, 2, 1, 1))
barplot(top_10_cropdmg$CROPDMG_real, names.arg = top_10_cropdmg$EVTYPE, ylab = "Crop Damage",
las = 3, col = "royalblue3")
barplot(top_10_propdmg$PROPDMG_real, names.arg = top_10_propdmg$EVTYPE, ylab = "Property Damage",
las = 3, col = "royalblue1")
title(main = "Impacts of Weather Events in Economic Problems", outer = TRUE)
Figure 3: Consequences of Weather Events on the Economy and Population Health
par(mfrow = c(1, 2), mar = c(10, 4, 0.5, 2.5), oma = c(1.5, 2, 1, 1))
barplot(top_10_sum_injury_n_fatalities$SUM_INJURY_N_FATALITIES, names.arg = top_10_sum_injury_n_fatalities$EVTYPE,
ylab = "Injuries and Fatalities", las = 3, col = "darkolivegreen2")
barplot(top_10_sum_propdmg_n_cropdmg$SUM_PROPDMG_N_CROPDMG, names.arg = top_10_sum_propdmg_n_cropdmg$EVTYPE,
ylab = "Crops and Property Damage", las = 3, col = "royalblue2")
title(main = "Impacts of Weather Events", outer = TRUE)
Results
Question 1: Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health?
We looked at the impact of various weather-related events on population health with repspect to injuries and fatalities. Based on the Figures 1 and 3, tornadoes had the most damaging effect on population health between 1950 and 2011. Specifically, more injuries and fatliaties were caused by tornadoes than any other weather-related event from 1950-2011.
Question 2: Across the United States, which types of events have the greatest economic consequences?
We looked at the economic consequences of various weather-realted events between 1950 and 2011, using crop and property damage as a measure of economic impact. Based on Figures 2 and 3, overall, tornadoes caused more damage to the economy between 1950 and 2011 than any other weather-related event; however, when looked at individually, droughts were most damaging to crops and tornadoes were most damaging to property.