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.

Loading Packages

library(tidyverse)
## -- Attaching packages ------------------------------------------------ tidyverse 1.3.0 --
## v ggplot2 3.3.0     v purrr   0.3.4
## v tibble  3.0.0     v dplyr   0.8.5
## v tidyr   1.0.2     v stringr 1.4.0
## v readr   1.3.1     v forcats 0.5.0
## -- Conflicts --------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()

Data Processing

storm <- read.csv("repdata_data_StormData.csv")

patt <- c(unique(storm$PROPDMGEXP), "k")
repl <- 10^c(3, 6, 0, 9, 6, 0, 0, 5, 6, -1, 4, 2, 3, 2, 7, 2, 0, 1, 8, 3)
for(i in 1:20) {
  storm[storm$PROPDMGEXP == patt[i], "PROPDMGEXP"] <- repl[i]
  storm[storm$CROPDMGEXP == patt[i], "CROPDMGEXP"] <- repl[i]
}
storm$PROPDMGTOT <- storm$PROPDMG*as.numeric(storm$PROPDMGEXP) + storm$CROPDMG*as.numeric(storm$CROPDMGEXP)

Results

  1. Across the United States, which types of events are most harmful with respect to population health?
fatalities_df <- storm %>%
  group_by(EVTYPE) %>%
  summarise(TOT_FATALITIES = sum(FATALITIES))

fatalities_top_10 <- head(fatalities_df[order(fatalities_df$TOT_FATALITIES, decreasing = TRUE),], 10)
fatalities_top_10$EVTYPE <- factor(fatalities_top_10$EVTYPE, levels = fatalities_top_10$EVTYPE[order(fatalities_top_10$TOT_FATALITIES)])

ggplot(fatalities_top_10, aes(x = EVTYPE, y = TOT_FATALITIES)) +
  geom_bar(stat = "identity") +
  labs(x = "EVENT TYPE", y = "TOTAL FATALITIES", title = "TOP 10 MOST HARMFUL WEATHER EVENTS") +
  coord_flip()

injuries_df <- storm %>%
  group_by(EVTYPE) %>%
  summarise(TOT_INJURIES = sum(INJURIES))

injuries_top_10 <- head(injuries_df[order(injuries_df$TOT_INJURIES, decreasing = TRUE),], 10)
injuries_top_10$EVTYPE <- factor(injuries_top_10$EVTYPE, levels = injuries_top_10$EVTYPE[order(injuries_top_10$TOT_INJURIES)])

ggplot(injuries_top_10, aes(x = EVTYPE, y = TOT_INJURIES)) +
  geom_bar(stat = "identity") +
  labs(x = "EVENT TYPE", y = "TOTAL INJURIES", title = "TOP 10 MOST HARMFUL WEATHER EVENTS") +
  coord_flip()

  1. Across the United States, which types of events have the greatest economic consequences?
econ_damage_df <- storm %>%
  group_by(EVTYPE) %>%
  summarise(TOT_PROPDMGTOT = sum(PROPDMGTOT))

econ_damage_top_10 <- head(econ_damage_df[order(econ_damage_df$TOT_PROPDMGTOT, decreasing = TRUE),], 10)
econ_damage_top_10$EVTYPE <- factor(econ_damage_top_10$EVTYPE, levels = econ_damage_top_10$EVTYPE[order(econ_damage_top_10$TOT_PROPDMGTOT)])

ggplot(econ_damage_top_10, aes(x = EVTYPE, y = TOT_PROPDMGTOT)) +
  geom_bar(stat = "identity") +
  labs(x = "EVENT TYPE", y = "TOTAL ECONOMIC DAMAGE", title = "TOP 10 EVENTS WITH GREATEST ECONOMIC DAMAGES") +
  coord_flip()