SYNOPSIS

Using the accumulated data of natural disasters from 1950 to 2011, we want to attempt to answer the following questions. 1. Across the United States, which types of events (as indicated in the π™΄πš…πšƒπšˆπ™Ώπ™΄ variable) are most harmful with respect to population health? 2. Across the United States, which types of events have the greatest economic consequences? For this study, population health is regarded as all casualties (fatalities and injuries), and economic consequences is the total cost of property damage and crops damage. Our analysis shows clearly that tornadoes have the most detrimental impact on both health and property costs, but additional health risks are heat-related casualties, floods, thunderstorms, and lightning. Property damage is also very high for flash floods, other floods, hail, thunderstorms, and wind storms.

DATA PROCESSING

## Unzip and read the data into R
StormData <- read.csv("repdata%2Fdata%2FStormData.csv.bz2", header=TRUE, stringsAsFactors = FALSE)

## Observe the data real quick, and see that the main information we need is in only a few columns
head(StormData)
##   STATE__           BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE
## 1       1  4/18/1950 0:00:00     0130       CST     97     MOBILE    AL
## 2       1  4/18/1950 0:00:00     0145       CST      3    BALDWIN    AL
## 3       1  2/20/1951 0:00:00     1600       CST     57    FAYETTE    AL
## 4       1   6/8/1951 0:00:00     0900       CST     89    MADISON    AL
## 5       1 11/15/1951 0:00:00     1500       CST     43    CULLMAN    AL
## 6       1 11/15/1951 0:00:00     2000       CST     77 LAUDERDALE    AL
##    EVTYPE BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END
## 1 TORNADO         0                                               0
## 2 TORNADO         0                                               0
## 3 TORNADO         0                                               0
## 4 TORNADO         0                                               0
## 5 TORNADO         0                                               0
## 6 TORNADO         0                                               0
##   COUNTYENDN END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES
## 1         NA         0                      14.0   100 3   0          0
## 2         NA         0                       2.0   150 2   0          0
## 3         NA         0                       0.1   123 2   0          0
## 4         NA         0                       0.0   100 2   0          0
## 5         NA         0                       0.0   150 2   0          0
## 6         NA         0                       1.5   177 2   0          0
##   INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES
## 1       15    25.0          K       0                                    
## 2        0     2.5          K       0                                    
## 3        2    25.0          K       0                                    
## 4        2     2.5          K       0                                    
## 5        2     2.5          K       0                                    
## 6        6     2.5          K       0                                    
##   LATITUDE LONGITUDE LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1     3040      8812       3051       8806              1
## 2     3042      8755          0          0              2
## 3     3340      8742          0          0              3
## 4     3458      8626          0          0              4
## 5     3412      8642          0          0              5
## 6     3450      8748          0          0              6
## Load the appropriate packages
library(ggvis)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

HEALTH RISK RESULTS

To determine the total health affects of natural disasters we will remove all columns from our data frame except the Event Type, Fatalities, and Injuries. We will then create a new column of total casualties, and then aggregate casualty totals by event.

## Health damage
SDhealth <- select(StormData, EVTYPE, FATALITIES, INJURIES) %>% # Filter DF to only relevant columns
        mutate(CASUALTIES = FATALITIES+INJURIES) %>%  # Total casualties
        group_by(EVTYPE) %>% summarise(TOTAL_CASUALTIES=sum(CASUALTIES)) %>% # Aggregate totals by event type
        arrange(desc(TOTAL_CASUALTIES)) # Sort descending

## We will just look at the top 20
SDhealth <- SDhealth[1:20,]
SDhealth %>% ggvis(~EVTYPE, ~TOTAL_CASUALTIES) %>% layer_bars() %>%
        add_axis("x", properties = axis_props(labels=(list(angle=45, align = "top")))) %>%
        add_axis("x", orient = "top", ticks = 0, title = "Fatalities and Injuries from Natural Disasters",
           properties = axis_props(
             axis = list(stroke = "white"),
             labels = list(fontSize = 0)))

Remove Tornadoes

Because tornadoes represent such a high disparity of casualties and it is difficult to see the actual relationship between other factors, we can remove that one element and re-plot the chart.

## Remove the top contender to balance out other factors
SDhealth2 <- SDhealth[2:20,]
SDhealth2 %>% ggvis(~EVTYPE, ~TOTAL_CASUALTIES) %>% layer_bars() %>%
        add_axis("x", properties = axis_props(labels=(list(angle=45, align = "top")))) %>%
        add_axis("x", orient = "top", ticks = 0, title = "Fatalities and Injuries (Minus Tornados)",
           properties = axis_props(
             axis = list(stroke = "white"),
             labels = list(fontSize = 0)))

PROPERTY RISK RESULTS

Similar to health risk, for property risk we will filter out only Event Type, Property Damage value and Crop Damage values, then aggregate totals in a new column.

## Property Damage vs Crop Damage
SDdmg <- select(StormData, EVTYPE, PROPDMG, CROPDMG) %>% # Filter DF to only relevant columns
        mutate(TOTALDMG = PROPDMG+CROPDMG) %>% # Total Damages
        group_by(EVTYPE) %>% summarise(TOTAL_DAMAGE=sum(TOTALDMG)) %>% # Aggregate damages
        arrange(desc(TOTAL_DAMAGE)) # Sort Descending

## Just look at the top 20
SDdmg <- SDdmg[1:20,]
SDdmg %>% ggvis(~EVTYPE, ~TOTAL_DAMAGE) %>% layer_bars() %>%
        add_axis("x", properties = axis_props(labels=(list(angle=45, align = "top")))) %>%
        add_axis("x", orient = "top", ticks = 0, title = "Damage from Natural Disasters",
           properties = axis_props(
             axis = list(stroke = "white"),
             labels = list(fontSize = 0)))

Based on this data we can clearly see that the most economic damage is caused by tornados, and after that flood events of various types and thunderstorms and windstorms.