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 project involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. 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.
storm <- read.csv(bzfile("StormData.bz2"))
Remove blanks and punctuation from the dataset.
event_types <- tolower(storm$EVTYPE)
event_types <- gsub("[[:blank:][:punct:]+]", " ", event_types)
Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health?
knitr::opts_chunk$set(fig.width=20, fig.height=8)
library(ggplot2)
fat <- aggregate(FATALITIES ~ EVTYPE, data=storm, sum)
inj <- aggregate(INJURIES ~ EVTYPE, data=storm, sum)
fat10 <- head(fat[order(fat$FATALITIES, decreasing = TRUE),],10)
inj10 <- head(inj[order(inj$INJURIES, decreasing = TRUE), ], 10)
ggplot(data=fat10,
aes(x=reorder(EVTYPE, FATALITIES), y=FATALITIES, fill=FATALITIES)) +
geom_bar(stat="identity") +
ylab("Total number of FATALITIES") +
xlab("Event type") + coord_flip()
ggplot(data=inj10,
aes(x=reorder(EVTYPE, INJURIES), y=INJURIES, fill=INJURIES)) +
geom_bar(stat="identity") +
ylab("Total number of FATALITIES") +
xlab("Event type") + coord_flip()
Across the United States, which types of events have the greatest economic consequences?
knitr::opts_chunk$set(fig.width=20, fig.height=8)
econ <- aggregate(PROPDMG ~ EVTYPE, data=storm, sum)
econ10 <- head(econ[order(econ$PROPDMG, decreasing = TRUE),],10)
ggplot(data=econ10,
aes(x=reorder(EVTYPE, PROPDMG), y=PROPDMG, fill=PROPDMG)) +
geom_bar(stat="identity") +
ylab("Total amount of Damage") +
xlab("Event type") + coord_flip()