Severe weather in the United States impacts lives and causes economy damage every year. This analysis will show the most significant types of severe weather events that adversely affect population health and cause economic damage beween 1950 and 2011.
This analysis explores the NOAA storm database of severe weather reports between 1950 and November 2011. It will answer two questions:
1. Which type of weather events cause the greatest number of weather related fatalities
2. Which type of weather events cause the greatest economical damage
This section contains R steps to download the data, import it into R and calculate results.
library(plyr)
## Warning: package 'plyr' was built under R version 3.1.2
library(knitr)
library(RCurl)
## Warning: package 'RCurl' was built under R version 3.1.2
## Loading required package: bitops
Data for this analysis can be found at: https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2
National Weather Service Storm Data Documentation
National Climatic Data Center Storm Events FAQ
R Code to Download Zip File to working directory.
fileUrl <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
destfilepath <- paste(getwd(),"/stormdata2.csv.bz2",sep="")
if (!file.exists(destfilepath)){
download.file(fileUrl, destfile=destfilepath)
}
R Code to Read in data from working directory.
stormdata <- read.csv(bzfile(destfilepath), fill=TRUE)
Sample data rows
head(stormdata, n=3)
## STATE__ BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE
## 1 1 4/18/1950 0:00:00 0130 CST 97 MOBILE AL
## 2 1 4/18/1950 0:00:00 0145 CST 3 BALDWIN AL
## 3 1 2/20/1951 0:00:00 1600 CST 57 FAYETTE AL
## EVTYPE BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END
## 1 TORNADO 0 0
## 2 TORNADO 0 0
## 3 TORNADO 0 0
## COUNTYENDN END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES
## 1 NA 0 14.0 100 3 0 0
## 2 NA 0 2.0 150 2 0 0
## 3 NA 0 0.1 123 2 0 0
## INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES
## 1 15 25.0 K 0
## 2 0 2.5 K 0
## 3 2 25.0 K 0
## LATITUDE LONGITUDE LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1 3040 8812 3051 8806 1
## 2 3042 8755 0 0 2
## 3 3340 8742 0 0 3
Summarizing the Data
PubHealthDamage <- ddply(stormdata, c("EVTYPE"),summarize,Fatalities=sum(FATALITIES))
PubHealthDamage <- PubHealthDamage[order(-PubHealthDamage["Fatalities"]),]
Top10FatalTypes <- PubHealthDamage[1:10,]
EconDamage <- ddply(stormdata, c("EVTYPE"),summarize,PropDmg=sum(PROPDMG))
EconDamage <- EconDamage[order(-EconDamage["PropDmg"]),]
Top10EconDmgTypes <- EconDamage[1:10,]
To understand the impact on public health, the number of fatalities related to the weather event was calculated. The Top 10 events causing the most fatalities shows Tornados cause the most weather related events. Tornados caused 5,633 fatalities over the 61 years of data tracked by NOAA.
par(mar=c(4,4,2,1))
par(oma=c(4,2,0,0))
PHPlot <- barplot(Top10FatalTypes$Fatalities, names.arg = Top10FatalTypes$EVTYPE, main="Top 10 Severe Weather Events Causing Most Fatalities",ylim=c(0,500+max(Top10FatalTypes$Fatalities)),las=2,col=c("red"))
text(PHPlot, Top10FatalTypes$Fatalities, labels=prettyNum(round(Top10FatalTypes$Fatalities),big.mark=","), pos=3, col="black")
dev.off()
## null device
## 1
To understand the impact on the economy, the measure of property damage related to the weather event was calculated. The Top 10 events causing the most damage shows tornados also cause the most weather related property damage. Tornados caused $3.2M in property damage over the 61 years of data tracked by NOAA.
par(mar=c(4,4,2,1))
par(oma=c(8,2,0,0))
EDPlot <- barplot(Top10EconDmgTypes$PropDmg, names.arg = Top10EconDmgTypes$EVTYPE, main="Top 10 Severe Weather Events Causing Most Property Damage",ylim=c(0,500000+max(Top10EconDmgTypes$PropDmg)),las=2,col=c("blue"))
dev.off()
## null device
## 1