Coursera Reproducible Research

Peer-graded Assignment: Course Project 2

Gerard van Meurs

November 6, 2018

The impact of weather events on public health and economy

Synopsis

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 study identifies weather events resulting in most fatalities (Tornado’s), most injuries (Tornado’s) and most economic damage (Floods). This project involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database.

Data Processing

# loading libraries; suppress warnings and messages in the output
library(readr)
library(dplyr)
library(ggplot2)
# set working directory
drive <- "G:/"
setwd(paste0(drive, "Coursera Training/Reproducible Research/project2"))

# reading in the dataset; use read_csv() from the readr-package
download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", destfile = "datafile.csv.bz2")

# reading in the dataset; use read_csv() from the readr-package
weatherdata <- read_csv("datafile.csv.bz2")
dim(weatherdata)
## [1] 902297     37

This study is based on the data of the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database, a database of 902,297 wheather events (with 37 variables) from early 1950 to November 2011. More documentatation on these data can be found on:

Results

Most fatalities are caused by Tornado’s, Excessive Heat, Flash Floods, Heat and Lightning.

#
# top-10 fatalities by type of event
#
weatherdata %>%
  select(EVTYPE, FATALITIES) %>%
  group_by(EVTYPE) %>%
  summarize(fatalities = sum(FATALITIES)) %>%
  arrange(desc(fatalities)) %>%
  top_n(10) %>%
  ggplot(aes(x = reorder(EVTYPE, fatalities), y = fatalities)) +
  geom_bar(stat = "identity", fill = "red") +
  ggtitle("Top-10 weather events by Fatalities") +
  labs(x = "Type of weather-event", y = "# of Fatalities") +
  coord_flip()

Most injuries are caused by Tornado’s as well, and to a much lesser extent by Tstm Winds, Floods, Excessive Heat and Lightning. The peak at Tornado’s (relative to other event types) id much sharper for injuries. In short, Tornado’s are most harmful with respect to population health.

#
# top-10 injuries by type of event
#
weatherdata %>%
  select(EVTYPE, INJURIES) %>%
  group_by(EVTYPE) %>%
  summarize(injuries = sum(INJURIES)) %>%
  arrange(desc(injuries)) %>%
  top_n(10) %>%
  ggplot(aes(x = reorder(EVTYPE, injuries), y = injuries)) +
  geom_bar(stat = "identity", fill = "red") +
  ggtitle("Top-10 weather events by Injuries") +
  labs(x = "Type of weather-event", y = "# of Injuries") +
  coord_flip()

Property damage is stored in two different variables: PROPDMG and PROPDMGEXP. PROPDMGEXP contains an alphabetical character signifying the magnitude of the number: K = 10^3, M = 10^6 and B = 10^9, the factor by which the damage in PROPDMG must be multiplied.The same pattern applies to CROPDMG and CROPDMGEXP. Economical damage is computed as the sum of the property damage and crop damage.

weatherdata %>%
  select(EVTYPE, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP) %>%
  mutate(propdam = PROPDMG * ifelse(PROPDMGEXP == "K", 10^3,
                                    ifelse(PROPDMGEXP == "M", 10^6,
                                           ifelse(PROPDMGEXP == "B", 10^9, 1))),
         cropdam = CROPDMG * ifelse(CROPDMGEXP == "K", 10^3,
                                    ifelse(CROPDMGEXP == "M", 10^6,
                                           ifelse(CROPDMGEXP =="B", 10^9, 1)))) %>%
  group_by(EVTYPE) %>%
  summarize(tot_damage = (sum(propdam, na.rm = TRUE) + sum(cropdam, na.rm = TRUE))/10^9) %>%
  arrange(desc(tot_damage)) %>%
  top_n(10) %>%
  ggplot(aes(x = reorder(EVTYPE, tot_damage), y = tot_damage)) +
  geom_bar(stat = "identity", fill = "red") +
  ggtitle("Top-10 weather events by Economic Damage") +
  labs(x = "Type of weather-event", y = "damage in billions of $") +
  coord_flip()

Most damage by event-type is caused by Floods, but Hurricanes/Typhoons, Tornado’s and Storm Surges also contribute substantial to the total economic damage of weather events.