Severe weather in the United States has the potential to cause property damage, crop damage, personal injury and even death. By looking at the types of weather that are most damaging to the economy and the citizens of the United States we can better prepare for these weather events and attempt to avoid costly damage, personal injury and death.
Data for this report was taken from the NOAA storm events database, which can be downloaded here http://www.ncdc.noaa.gov/stormevents/. In the version of the NOAA storm events database used for this report data was collected between 1950 and 2011. Between 1950 and 1955 only information for tornado activity was collected. Between 1955 and 1996 information was collected on tornado, thunderstorm wind, and hail. After 1996 NOAA standardized data collection with directive 10-1605 and started collecting data on 48 specific event types. Because of this, data for this report is taken from the 48 event types specified by directive 10-1605 after 1996. Data from the NOAA storm events database was downloaded and then loaded into R with the following code.
#read data into R
stormdata <-read.csv("repdata-data-StormData.csv.bz2")
#subset data from 1/1/1996 to 11/28/2011
stormdata <- stormdata[min(which(stormdata$BGN_DATE == "1/1/1996 0:00:00")):902297,]
#47 event types from directive 10-1605 Debris Slide never reported
types <- unique(stormdata$EVTYPE[grep("2011", stormdata$BGN_DATE)])
types <- as.character(types)
types <- c(types, "TROPICAL DEPRESSION")
types <- as.factor(types)
#subset by 47 event types
stormdata <- stormdata[stormdata$EVTYPE %in% types,]
Total injuries and fatalities resulting from the 48 NOAA weather event types are sorted and summed togeter with the following code.
#total fatalities by event type sorted in decending order
totalfatal <- aggregate(FATALITIES ~ EVTYPE, stormdata, sum)
totalfatal <- totalfatal[order(totalfatal$FATALITIES, decreasing = TRUE),]
totalfatal$EVTYPE <- factor(totalfatal$EVTYPE,
levels = totalfatal$EVTYPE[order(totalfatal$FATALITIES,
decreasing = TRUE)])
#total injuries by event type sorted in decending order
totalinjuries <- aggregate(INJURIES ~ EVTYPE, stormdata, sum)
totalinjuries <- totalinjuries[order(totalinjuries$INJURIES, decreasing = TRUE),]
totalinjuries$EVTYPE <- factor(totalinjuries$EVTYPE,
levels = totalinjuries$EVTYPE[order(totalinjuries$INJURIES,
decreasing = TRUE)])
Below is a bar graph of the ten weather events that produced the most injuries and fatalities between 1996 and 2011.
library(ggplot2) #for use of ggplot()
library(gridExtra) #for use of grid.arrange()
#plot of top 10 total fatalities by event type
g1 <- ggplot(totalfatal[1:10,], aes(x = EVTYPE[1:10], y = FATALITIES[1:10]))
g1 <- g1 + geom_bar(stat = "identity", colour = "darkred", fill = "darkred", width = .5)
g1 <- g1 + labs(title = "Most Fatal-Injurious Weather Events in the U.S. 1996 - 2011",
x = NULL, y = "Fatalities")
g1 <- g1 + theme(axis.text.x = element_text(angle=8))
#plot of top 10 events types that cause the most injuries
g2 <- ggplot(totalinjuries[1:10,], aes(x = EVTYPE[1:10], y = INJURIES[1:10]))
g2 <- g2 + geom_bar(stat = "identity", colour = "darkblue", fill = "darkblue", width = .5)
g2 <- g2 + labs(x = NULL, y = "Injuries")
g2 <- g2 + theme(axis.text.x = element_text(angle=8))
#arrange plots g1 and g2 in a grid
grid.arrange(g1,g2)
Total crop and property damage for the 48 NOAA weather event types are subset from the original data set with the code below.
#subset damage and event type and set colnames
stormdamage <- data.frame(stormdata$EVTYPE, stormdata$PROPDMG, stormdata$PROPDMGEXP,
stormdata$CROPDMG, stormdata$CROPDMGEXP)
colnames(stormdamage) <- c("EVTYPE","PROPDMG","PROPDMGEXP","CROPDMG","CROPDMGEXP")
#multiply property damage by property damage exp
k <- which(stormdamage$PROPDMGEXP == "K" | stormdamage$PROPDMGEXP == "k")
m <- which(stormdamage$PROPDMGEXP == "M" | stormdamage$PROPDMGEXP == "m")
b <- which(stormdamage$PROPDMGEXP == "B" | stormdamage$PROPDMGEXP == "b")
stormdamage$PROPDMG[k] <- stormdamage$PROPDMG[k] * 1000
stormdamage$PROPDMG[m] <- stormdamage$PROPDMG[m] * 1000000
stormdamage$PROPDMG[b] <- stormdamage$PROPDMG[b] * 1000000000
#multiply crop damage by crop damage exp
k1 <- which(stormdamage$CROPDMGEXP == "K" | stormdamage$CROPDMGEXP == "k")
m1 <- which(stormdamage$CROPDMGEXP == "M" | stormdamage$CROPDMGEXP == "m")
b1 <- which(stormdamage$CROPDMGEXP == "B" | stormdamage$CROPDMGEXP == "b")
stormdamage$CROPDMG[k1] <- stormdamage$CROPDMG[k1] * 1000
stormdamage$CROPDMG[m1] <- stormdamage$CROPDMG[m1] * 1000000
stormdamage$CROPDMG[b1] <- stormdamage$CROPDMG[b1] * 1000000000
#sum crop and property damage
TOTALDMG <- stormdamage$PROPDMG + stormdamage$CROPDMG
#combine total damage with data frame
stormdamage <- data.frame(stormdamage, TOTALDMG)
#sum total property damage by event type and sort by decreasing values
totalprop <- aggregate(PROPDMG ~ EVTYPE, stormdamage, sum)
totalprop <- totalprop[order(totalprop$PROPDMG, decreasing = TRUE),]
totalprop$EVTYPE <- factor(totalprop$EVTYPE,
levels = totalprop$EVTYPE[order(totalprop$PROPDMG,
decreasing = TRUE)])
#sum total crop damage by event type and sort by decreasing values
totalcrop <- aggregate(CROPDMG ~ EVTYPE, stormdamage, sum)
totalcrop <- totalcrop[order(totalcrop$CROPDMG, decreasing = TRUE),]
totalcrop$EVTYPE <- factor(totalcrop$EVTYPE,
levels = totalcrop$EVTYPE[order(totalcrop$CROPDMG,
decreasing = TRUE)])
#sum total damage by event type and sort by decreasing values
totaldamage <- aggregate(TOTALDMG ~ EVTYPE, stormdamage, sum)
totaldamage <- totaldamage[order(totaldamage$TOTALDMG, decreasing = TRUE),]
totaldamage$EVTYPE <- factor(totaldamage$EVTYPE,
levels = totaldamage$EVTYPE[order(totaldamage$TOTALDMG,
decreasing = TRUE)])
Below is a bar chart that shows total crop damage, property damage and the sum of the of both crop and property damage of the ten most costly weather events.
g3 <- ggplot(totaldamage[1:10,], aes(x = EVTYPE[1:10], y = TOTALDMG[1:10]))
g3 <- g3 + geom_bar(stat ="identity", colour="darkgreen", fill="black", width = .5)
g3 <- g3 + labs(title = "Total Cost(Property + Crop) of Weather Damage in th U.S. 1996 - 2011",
x = "Event", y = "Damage in Dollars")
g3 <- g3 + theme(axis.text.x = element_text(angle=8))
g4 <- ggplot(totalprop[1:10,], aes(x = EVTYPE[1:10], y = PROPDMG[1:10]))
g4 <- g4 + geom_bar(stat ="identity", colour="darkgreen", fill="darkblue", width = .5)
g4 <- g4 + labs(title = "Cost of Property Weather Damage in th U.S. 1996 - 2011",
x = "Event", y = "Damage in Dollars")
g4 <- g4 + theme(axis.text.x = element_text(angle=8))
g5 <- ggplot(totalcrop[1:10,], aes(x = EVTYPE[1:10], y = CROPDMG[1:10]))
g5 <- g5 + geom_bar(stat ="identity", colour="darkgreen", fill="darkgreen", width = .5)
g5 <- g5 + labs(title = "Cost of Crop Weather Damage in th U.S. 1996 - 2011",
x = "Event", y = "Damage in Dollars")
g5 <- g5 + theme(axis.text.x = element_text(angle=8))
#arrange plots g3, g4, g5 in a grid
grid.arrange(g4,g5,g3)
In the bar chat showing injuries and fatalities, tornadoes cause the most injuries and the second most fatalities. Lightning, excessive heat, flood, and flash flood are in the top five for most fatal and most injurious weather events.
In the bar chart showing crop and property damage you can see flood, and hail are both in the top five most costly weather events.