Title: An analysis of the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database

Synopsis

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.

The events in the database start in the year 1950 and end in November 2011.
The analysis in this document try to respond with tables and graphs at two questions:
1. Across the United States, which types of events are most harmful with respect to population health?
2. Across the United States, which types of events have the greatest economic consequences?


1. Data Processing

1.1 Settings
Download the file and load the data and required libraries.

#install.packages("rsConnect")
#download.file("https://d396qusza40orc.cloustormront.net/repdata%2Fdata%2FStormData.csv.bz2", destfile = "repdata%2Fdata%2FStormData.csv")
storm <- read.csv("repdata%2Fdata%2FStormData.csv")
#install.packages("R.utils")
library(R.utils)
#install.packages("dplyr")
library(dplyr)
library(ggplot2)
#install.packages("xtable")
library(xtable)
library(bit64)


1.2 Table summary to find the most harmful events with respect to population health.
Injuries and fatalities are the variables considerated for this part of the analysis. Tables with summaries are created with this new variables for each event: Num (total number), Fatalities, Injuries, FatalitiesAVG (average number of fatalities), InjuriesAVG, PercWithFatalities (percentage of events with at least one dead) PercWithInjuries (percentage of events with at least one injury).

#Total fatalities for each event type (EVTYPE)
storm.fatalities <- storm %>% select(EVTYPE, FATALITIES) %>% group_by(EVTYPE) %>% summarise(total.fatalities = sum(FATALITIES)) %>% arrange(-total.fatalities)

#HEader info for fatalities
head(storm.fatalities, 10)
## # A tibble: 10 Ă— 2
##            EVTYPE total.fatalities
##            <fctr>            <dbl>
## 1         TORNADO             5633
## 2  EXCESSIVE HEAT             1903
## 3     FLASH FLOOD              978
## 4            HEAT              937
## 5       LIGHTNING              816
## 6       TSTM WIND              504
## 7           FLOOD              470
## 8     RIP CURRENT              368
## 9       HIGH WIND              248
## 10      AVALANCHE              224
#Total injuries  for each event type (EVTYPE)
storm.injuries <- storm %>% select(EVTYPE, INJURIES) %>% group_by(EVTYPE) %>% summarise(total.injuries = sum(INJURIES)) %>% arrange(-total.injuries)

#HEader info for injuries
head(storm.injuries, 10)
## # A tibble: 10 Ă— 2
##               EVTYPE total.injuries
##               <fctr>          <dbl>
## 1            TORNADO          91346
## 2          TSTM WIND           6957
## 3              FLOOD           6789
## 4     EXCESSIVE HEAT           6525
## 5          LIGHTNING           5230
## 6               HEAT           2100
## 7          ICE STORM           1975
## 8        FLASH FLOOD           1777
## 9  THUNDERSTORM WIND           1488
## 10              HAIL           1361


1.3 Table summary for find the events that have the greatest economic consequences.
Property and crop damage exponents for each level is listed out and assigned those values for the property exponent data. Invalid data was excluded. Property damage value was calculated by multiplying the property damage and property exponent value. Total damages are the final variable that sum property and crop damages.

Index in the PROPDMGEXP and CROPDMGEXP can be interpreted as the following:-

H, h -> hundreds = x100 K, K -> kilos = x1,000 M, m -> millions = x1,000,000 B,b -> billions = x1,000,000,000 (+) -> x1 (-) -> x0 (?) -> x0 blank -> x0

The total damage caused by each event type is calculated with the following code.

storm.damage <- storm %>% select(EVTYPE, PROPDMG,PROPDMGEXP,CROPDMG,CROPDMGEXP)

Symbol <- sort(unique(as.character(storm.damage$PROPDMGEXP)))
Multiplier <- c(0,0,0,1,10,10,10,10,10,10,10,10,10,10^9,10^2,10^2,10^3,10^6,10^6)
convert.Multiplier <- data.frame(Symbol, Multiplier)

storm.damage$Prop.Multiplier <- convert.Multiplier$Multiplier[match(storm.damage$PROPDMGEXP, convert.Multiplier$Symbol)]
storm.damage$Crop.Multiplier <- convert.Multiplier$Multiplier[match(storm.damage$CROPDMGEXP, convert.Multiplier$Symbol)]

storm.damage <- storm.damage %>% mutate(PROPDMG = PROPDMG*Prop.Multiplier) %>% mutate(CROPDMG = CROPDMG*Crop.Multiplier) %>% mutate(TOTAL.DMG = PROPDMG+CROPDMG)

storm.damage.total <- storm.damage %>% group_by(EVTYPE) %>% summarize(TOTAL.DMG.EVTYPE = sum(TOTAL.DMG))%>% arrange(-TOTAL.DMG.EVTYPE) 

head(storm.damage.total,10)
## # A tibble: 10 Ă— 2
##               EVTYPE TOTAL.DMG.EVTYPE
##               <fctr>            <dbl>
## 1              FLOOD     150319678250
## 2  HURRICANE/TYPHOON      71913712800
## 3            TORNADO      57352117607
## 4        STORM SURGE      43323541000
## 5        FLASH FLOOD      17562132111
## 6            DROUGHT      15018672000
## 7          HURRICANE      14610229010
## 8        RIVER FLOOD      10148404500
## 9          ICE STORM       8967041810
## 10    TROPICAL STORM       8382236550



2. Results

2.1 The most harmful events with respect to population health.
The table and the graph below show the events with the large number of fatalities.

# graph with fatalities per event
g <- ggplot(storm.fatalities[1:10,], aes(x=reorder(EVTYPE, -total.fatalities), y=total.fatalities))

g + geom_bar(stat="identity") + labs(title="Top 10 weather events for number of fatalities", x="Event",y="Fatalities")


The table and the graph below show the events with the large number of injuries.

# graph with injuries per event
g2 <- ggplot(storm.injuries[1:10,], aes(x=reorder(EVTYPE, -total.injuries), y=total.injuries))
g2+geom_bar(stat='identity') + labs(title="Top 10 weather events for number of injuries", x="Event",y="Injuries")

Based on the data, TORNADO caused the maximum number of fatalities and injuries, and for this reason it’s the most harmful with respect to population health.


2.2 The events that have the greatest economic consequences.

# graph with damages per event
h <- ggplot(storm.damage.total[1:10,], aes(x=reorder(EVTYPE, -TOTAL.DMG.EVTYPE), y=TOTAL.DMG.EVTYPE))
h+geom_bar(stat='identity')+labs(title="Top 10 weather events for damages (billions of dollars)", x="Event",y="Total Damages (billions of dollars)")

Based on the data, FLOOD have the greatest economic consequences.