During the period 1950-2011, tornadoes were responsible for 62.4% of weather-related deaths and injuries, followed by wind, excessive heat, floods, and snow. Flooding produced the greatest economic impact through floods, storm surge, and flash floods. Significant damage was also produced by hurricanes and tornados.
library(dplyr)
if (!exists("storm")) {
url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
datafile <- "FStormData.csv.bz2"
if (!file.exists(datafile)) {
download.file(url, datafile, mode = "wb")
}
storm <- read.csv(datafile, stringsAsFactors = FALSE)
storm <- storm %>%
select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP,
CROPDMG, CROPDMGEXP) %>%
filter(PROPDMG > 0 | CROPDMG > 0 | FATALITIES > 0 | INJURIES > 0)
}
Damages to crops and property are given a code that indicates measurement units. K - thousands, M - millions, B - billions
# Multiply Out Property Values
storm$PROPDMG[storm$PROPDMGEXP == "K"] <- 10 ^ 3 *
storm$PROPDMG[storm$PROPDMGEXP == "K"]
storm$PROPDMG[storm$PROPDMGEXP == "M"] <- 10 ^ 6 *
storm$PROPDMG[storm$PROPDMGEXP == "M"]
storm$PROPDMG[storm$PROPDMGEXP == "B"] <- 10 ^ 9 *
storm$PROPDMG[storm$PROPDMGEXP == "B"]
# Multiply Out Crop Values
storm$CROPDMG[storm$CROPDMGEXP == "K"] <- 10 ^ 3 *
storm$CROPDMG[storm$CROPDMGEXP == "K"]
storm$CROPDMG[storm$CROPDMGEXP == "M"] <- 10 ^ 6 *
storm$CROPDMG[storm$CROPDMGEXP == "M"]
storm$CROPDMG[storm$CROPDMGEXP == "B"] <- 10 ^ 9 *
storm$CROPDMG[storm$CROPDMGEXP == "B"]
There are 488 types of events that caused loss of life, injuries, crop damage, or property damage. Similarly named events will be grouped together.
storm$EVTYPE <- tolower(storm$EVTYPE)
storm$EVTYPE[grepl("tornado|waterspout", storm$EVTYPE)] <- "tornado"
storm$EVTYPE[grepl("hurricane|typhoon|tropical storm",
storm$EVTYPE)] <- "hurricane"
storm$EVTYPE[grepl("fire", storm$EVTYPE)] <- "wildfire"
storm$EVTYPE[grepl("flash flood", storm$EVTYPE)] <- "flash flood"
storm$EVTYPE[grepl("heat", storm$EVTYPE)] <- "heat"
storm$EVTYPE[grepl("wind", storm$EVTYPE)] <- "wind"
storm$EVTYPE[grepl("winter|snow|ice|blizzard|wintry", storm$EVTYPE)] <- "snow"
health <- storm %>%
select(Event = EVTYPE, FATALITIES, INJURIES) %>%
group_by(Event) %>%
summarize(Deaths = sum(FATALITIES), Injuries = sum(INJURIES)) %>%
mutate(Event = factor(Event), Total = Deaths + Injuries) %>%
arrange(desc(Total))
barplot(t(health[1:5, 2:3]), names.arg = health$Event[1:5],
legend.text = TRUE, col = c("wheat4", "wheat1"), ylab = "Individuals",
main = "Deaths and Injuries from Weather Events 1950-2011")
Historically, tornadoes are responsible for 62.4% of the weather-related deaths and injuries in the US.
costs <- storm %>%
select(Event = EVTYPE, PROPDMG, CROPDMG) %>%
group_by(Event) %>%
summarize(Property = round(sum(PROPDMG) / 10^9, digits = 1),
Crops = round(sum(CROPDMG) / 10^9, digits = 1)) %>%
mutate(Total = Property + Crops) %>%
arrange(desc(Total))
barplot(costs$Total[1:5], names.arg = costs$Event[1:5], col = "wheat1",
ylab = "Damages (billions of dollars)",
main = "Cost of Damage to Property and Crops
from Weather Events 1950-2011")
The greatest amount of property and crop damage is produced by flooding, though hurricanes and tornadoes also produce significant damage. Note that the values used have not been adjusted for inflation.