Severe Weather Events have the potential to cause great harm to both public health and the economy. This report reviews the data collected by the National Oceanic and Atmospheric Administration (NOAA) on the impacts of storm events in the United States to understand the impact of different storm types. Total number of injuries and fatalities are used to estimate the public health impact, and total value of propery and crop damages are used to estimate economic impact.
This report looks to answer the following questions: Which type of storm event has the highest impact on human health? and Which type of storm event causes the largest economic imapact?
destfile<- "StormData.csv.bz2"
url<-"https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
download.file(url,destfile)
data<-read.csv(bzfile("StormData.csv.bz2"),header=T)
stormdata<- data[,c("EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP",
"CROPDMG", "CROPDMGEXP")]
head(stormdata)
## EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## 1 TORNADO 0 15 25.0 K 0
## 2 TORNADO 0 0 2.5 K 0
## 3 TORNADO 0 2 25.0 K 0
## 4 TORNADO 0 2 2.5 K 0
## 5 TORNADO 0 2 2.5 K 0
## 6 TORNADO 0 6 2.5 K 0
H<-10^2
K<- 10^3
M<- 10^4
B<-10^9
## Total Property damage = PROPDMG * PROPDMGEXP
stormdata$TOTALPROPDMG=0
stormdata[stormdata$PROPDMGEXP == "H", ]$TOTALPROPDMG =
stormdata[stormdata$PROPDMGEXP == "H", ]$PROPDMG * H
stormdata[stormdata$PROPDMGEXP == "K", ]$TOTALPROPDMG =
stormdata[stormdata$PROPDMGEXP == "K", ]$PROPDMG * K
stormdata[stormdata$PROPDMGEXP == "M", ]$TOTALPROPDMG =
stormdata[stormdata$PROPDMGEXP == "M", ]$PROPDMG * M
stormdata[stormdata$PROPDMGEXP == "B", ]$TOTALPROPDMG =
stormdata[stormdata$PROPDMGEXP == "B", ]$PROPDMG * B
## Total Crop Damage = CROPDMG * CROPDMGEXP
stormdata$TOTALCROPDMG=0
stormdata[stormdata$CROPDMGEXP == "H", ]$TOTALCROPDMG =
stormdata[stormdata$CROPDMGEXP == "H", ]$CROPDMG * H
stormdata[stormdata$CROPDMGEXP == "K", ]$TOTALCROPDMG =
stormdata[stormdata$CROPDMGEXP == "K", ]$CROPDMG * K
stormdata[stormdata$CROPDMGEXP == "M", ]$TOTALCROPDMG =
stormdata[stormdata$CROPDMGEXP == "M", ]$CROPDMG * M
stormdata[stormdata$CROPDMGEXP == "B", ]$TOTALCROPDMG =
stormdata[stormdata$CROPDMGEXP == "B", ]$CROPDMG * B
Across the United States, which types of events (as indicated in the variable EVTYPE) are most harmful with respect to population health?
totalhealth<- aggregate(FATALITIES + INJURIES ~ EVTYPE,
data= stormdata, sum)
names(totalhealth) = c("EVTYPE","TOTALHEALTH")
totalhealth <- totalhealth[order(-totalhealth$TOTALHEALTH), ][1:10, ]
totalhealth$EVTYPE <- factor(totalhealth$EVTYPE, levels = totalhealth$EVTYPE)
#Load the package ggplot2 to make figures #
library(ggplot2)
ggplot(totalhealth, aes(x = EVTYPE, y = TOTALHEALTH)) +
geom_bar(stat = "identity") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
xlab("") +
ylab("Total Number of Health Events")
Figure 1. Total number of human health events, as represented by the combined sum of fatalities and injuries, for the top 10 most impactful storm events.
Conclusion: Tornados have the highest imapct on public health. Tornados cause the highest number of combined fatalities and injuries as seen in Figure 1
Across the United States, which types of events have the greatest economic consequences?
totaldamage<- aggregate(TOTALPROPDMG + TOTALCROPDMG ~ EVTYPE,
data= stormdata, sum)
names(totaldamage) = c("EVTYPE","TOTALDMG")
totaldamage <- totaldamage[order(-totaldamage$TOTALDMG), ][1:10, ]
totaldamage$EVTYPE <- factor(totaldamage$EVTYPE, levels = totaldamage$EVTYPE)
Scaling Total Damages by “millions of USD”
totaldamage$TOTALDMG<- totaldamage$TOTALDMG/10^6
ggplot(totaldamage, aes(x = EVTYPE, y = TOTALDMG)) +
geom_bar(stat = "identity") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
xlab("") +
ylab("CDamages (millions of USD)")
Figure 2. Total Ecomonic Impact, represented in millions of USD of combined property and crop damage, for the Top 10 most impactful storm events.
Conclusion: Floods are the storm event that cause the largest amount of economic damage as seen in Figure 2.