Synopsis

This report was created to explore the NOAA Storm Data base to answer some questions about severe weather events

The questions explored in this analysis are:

  1. Across the United States, which types of events (as indicated in the EVTYPE) are most harmful with respect to population health?
  2. Across the United States, which types of events have the greatest economic consequences?

Population health impact is measured using the combined total of fatalities and injuries. Economic impact is measured using the combined value of property and crop damage.

Data Processing

Load Required Packages

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
library(ggplot2)
library(scales)

Read Data

stormData <- read.csv("repdata_data_StormData.csv",
                      stringsAsFactors = FALSE)

dim(stormData)
## [1] 902297     37

Review Variables

names(stormData)
##  [1] "STATE__"    "BGN_DATE"   "BGN_TIME"   "TIME_ZONE"  "COUNTY"    
##  [6] "COUNTYNAME" "STATE"      "EVTYPE"     "BGN_RANGE"  "BGN_AZI"   
## [11] "BGN_LOCATI" "END_DATE"   "END_TIME"   "COUNTY_END" "COUNTYENDN"
## [16] "END_RANGE"  "END_AZI"    "END_LOCATI" "LENGTH"     "WIDTH"     
## [21] "F"          "MAG"        "FATALITIES" "INJURIES"   "PROPDMG"   
## [26] "PROPDMGEXP" "CROPDMG"    "CROPDMGEXP" "WFO"        "STATEOFFIC"
## [31] "ZONENAMES"  "LATITUDE"   "LONGITUDE"  "LATITUDE_E" "LONGITUDE_"
## [36] "REMARKS"    "REFNUM"

The variables used in this analysis are:

  • EVTYPE
  • FATALITIES
  • INJURIES
  • PROPDMG
  • PROPDMGEXP
  • CROPDMG
  • CROPDMGEXP

Convert Damage Exponents

The property and crop damage values use exponents to indicate magnitude.

convert_exp <- function(exp){

    exp <- toupper(as.character(exp))

    ifelse(exp == "H", 1e2,
    ifelse(exp == "K", 1e3,
    ifelse(exp == "M", 1e6,
    ifelse(exp == "B", 1e9,
    ifelse(exp == "0", 1,
    ifelse(exp == "1", 10,
    ifelse(exp == "2", 100,
    ifelse(exp == "3", 1000,
    ifelse(exp == "4", 10000,
    ifelse(exp == "5", 100000,
    ifelse(exp == "6", 1e6,
    ifelse(exp == "7", 1e7,
    ifelse(exp == "8", 1e8,
    1)))))))))))))
}

Calculate Total Economic Damage

stormData$PROP_MULT <- convert_exp(stormData$PROPDMGEXP)
stormData$CROP_MULT <- convert_exp(stormData$CROPDMGEXP)

stormData$PROP_DAMAGE <- stormData$PROPDMG * stormData$PROP_MULT
stormData$CROP_DAMAGE <- stormData$CROPDMG * stormData$CROP_MULT

stormData$TOTAL_DAMAGE <-
    stormData$PROP_DAMAGE +
    stormData$CROP_DAMAGE

Population Health Analysis

Total fatalities and injuries are aggregated by event type.

healthImpact <- stormData %>%
    group_by(EVTYPE) %>%
    summarise(
        Fatalities = sum(FATALITIES, na.rm = TRUE),
        Injuries = sum(INJURIES, na.rm = TRUE)
    ) %>%
    mutate(
        TotalHealthImpact = Fatalities + Injuries
    ) %>%
    arrange(desc(TotalHealthImpact))

topHealth <- head(healthImpact, 10)

Economic Impact Analysis

Total property and crop damages are aggregated by event type.

economicImpact <- stormData %>%
    group_by(EVTYPE) %>%
    summarise(
        TotalDamage = sum(TOTAL_DAMAGE, na.rm = TRUE)
    ) %>%
    arrange(desc(TotalDamage))

topEconomic <- head(economicImpact, 10)

Results

Across the United States, Which Types of Events Are Most Harmful With Respect to Population Health?

topHealth[1, ]
## # A tibble: 1 × 4
##   EVTYPE  Fatalities Injuries TotalHealthImpact
##   <chr>        <dbl>    <dbl>             <dbl>
## 1 TORNADO       5633    91346             96979

The event type above represents the greatest impact on population health when fatalities and injuries are combined.

ggplot(topHealth,
       aes(x = reorder(EVTYPE, TotalHealthImpact),
           y = TotalHealthImpact)) +
    geom_bar(stat = "identity",
             fill = "steelblue") +
    coord_flip() +
    labs(
        title = "Top 10 Weather Events by Population Health Impact",
        x = "Event Type",
        y = "Fatalities and Injuries"
    ) +
    theme_minimal()

The tornado has the greatest impact on population health when combining fatalities and injuries - 96979

Across the United States, Which Types of Events Have the Greatest Economic Consequences?

topEconomic[1, ]
## # A tibble: 1 × 2
##   EVTYPE  TotalDamage
##   <chr>         <dbl>
## 1 FLOOD  150319678257
ggplot(topEconomic,
       aes(x = reorder(EVTYPE, TotalDamage),
           y = TotalDamage)) +
    geom_bar(stat = "identity",
             fill = "darkred") +
    coord_flip() +
    scale_y_continuous(labels = dollar_format()) +
    labs(
        title = "Top 10 Weather Events by Economic Consequences",
        x = "Event Type",
        y = "Total Damage (USD)"
    ) +
    theme_minimal()

The flood has the greatest economical impact with $150319678257 USD in damages.