Synopsis

Severe weather events are detrimental to both health and economic activity. This analysis uses historical data from 1950 to November 2011, which is gathered from the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. Number of fatalities, injuries, and total economic damage done to crops and property is collected for each severe weather event. The event ‘Tornado’ is the most harmful to human health, while ‘flood’ causes the most economic damage.

Loading and Processing Raw Data

Loading

Data were downloaded from https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2. The following links provide the documentation (https://d396qusza40orc.cloudfront.net/repdata%2Fpeer2_doc%2Fpd01016005curr.pdf) and FAQ (https://d396qusza40orc.cloudfront.net/repdata%2Fpeer2_doc%2FNCDC%20Storm%20Events-FAQ%20Page.pdf) for the data.

if (!file.exists("./storm.csv.bz2")) {
    download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", 
        "./storm.csv.bz2")
}
# unzip file
if (!file.exists("./storm.csv")) {
    library(R.utils)
    bunzip2("./storm.csv.bz2", "./storm.csv", remove = FALSE)
}
storm.data <- read.csv("./storm.csv")

There are 902297 observations and 37 variables. There are 985 different severe weather classifications.

dim(storm.data)
## [1] 902297     37
length(unique(storm.data$EVTYPE))
## [1] 985
head(storm.data)
##   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

Processing

For the purpose of this analysis, we are only interested with the type of severe weather event, fatalities, injuries, and damagaes to property and crops. ‘newData’ will be the data frame used for the rest of this analysis and will only include the variables measuring the forementioned statistics.

newData <- storm.data[, c("EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP","CROPDMG", "CROPDMGEXP")]
dim(newData)
## [1] 902297      7

There are 902297 observations and 7 variables in ‘newData’. There are no missing values in the data frame.

sum(is.na(storm.data))
## [1] 1745947

Quick glance of the data:

summary(newData)
##                EVTYPE         FATALITIES          INJURIES        
##  HAIL             :288661   Min.   :  0.0000   Min.   :   0.0000  
##  TSTM WIND        :219940   1st Qu.:  0.0000   1st Qu.:   0.0000  
##  THUNDERSTORM WIND: 82563   Median :  0.0000   Median :   0.0000  
##  TORNADO          : 60652   Mean   :  0.0168   Mean   :   0.1557  
##  FLASH FLOOD      : 54277   3rd Qu.:  0.0000   3rd Qu.:   0.0000  
##  FLOOD            : 25326   Max.   :583.0000   Max.   :1700.0000  
##  (Other)          :170878                                         
##     PROPDMG          PROPDMGEXP        CROPDMG          CROPDMGEXP    
##  Min.   :   0.00          :465934   Min.   :  0.000          :618413  
##  1st Qu.:   0.00   K      :424665   1st Qu.:  0.000   K      :281832  
##  Median :   0.00   M      : 11330   Median :  0.000   M      :  1994  
##  Mean   :  12.06   0      :   216   Mean   :  1.527   k      :    21  
##  3rd Qu.:   0.50   B      :    40   3rd Qu.:  0.000   0      :    19  
##  Max.   :5000.00   5      :    28   Max.   :990.000   B      :     9  
##                    (Other):    84                     (Other):     9
head(newData)
##    EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## 1 TORNADO          0       15    25.0          K       0           
## 2 TORNADO          0        0     2.5          K       0           
## 3 TORNADO          0        2    25.0          K       0           
## 4 TORNADO          0        2     2.5          K       0           
## 5 TORNADO          0        2     2.5          K       0           
## 6 TORNADO          0        6     2.5          K       0

Results

Fatalities

The events that have caused the most fatalities from 1950-2011 are examined in this section.

deaths <- aggregate(FATALITIES~EVTYPE, newData, sum)
deaths <- deaths[order(deaths$FATALITIES, decreasing = TRUE),]
barplot (height = deaths$FATALITIES[1:30], names.arg = deaths$EVTYPE[1:30], las = 2, cex.names= 0.5, col = rainbow (30, start=0, end=1))
title(main = "Top 30 Events With Most Fatalities")
title(ylab = "Total Number of Fatalities")

This bar graph shows the 30 events that caused the most fatalities, in descending order.

Injuries

The events that have caused the most fatalities from 1950-2011 are examined in this section.

injuries <- aggregate(INJURIES~EVTYPE, newData, sum)
injuries <- injuries[order(injuries$INJURIES, decreasing = TRUE), ]
par(mar=c(12, 6, 1, 1))
barplot(height = injuries$INJURIES[1:30], names.arg = injuries$EVTYPE[1:30], las = 2, cex.names = 0.5, col = rainbow(30, start = 0, end = 1))
title(main = "Top 30 Events With Most Injuries", line = 0)
title(ylab = "Total Number of Injuries", line = 4)

This bar graph shows the 30 events that caused the most injuries, in descending order.

Economic Damage

This section examines the events that have caused the most economic damage. Economic damage is represented by the total dollar amount of damage done to property and crops.

symbol <- c("", "+", "-", "?", 0:9, "h", "H", "k", "K", "m", "M", "b", "B");
factor <- c(rep(0,4), 0:9, 2, 2, 3, 3, 6, 6, 9, 9)
multiplier <- data.frame (symbol, factor)

newData$damage.prop <- newData$PROPDMG*10^multiplier[match(newData$PROPDMGEXP,multiplier$symbol),2]
newData$damage.crop <- newData$CROPDMG*10^multiplier[match(newData$CROPDMGEXP,multiplier$symbol),2]
newData$damage <- newData$damage.prop + newData$damage.crop

total.damage <- aggregate (damage~EVTYPE, newData, sum);
total.damage$billion <- total.damage$damage / 1e9;
total.damage <- total.damage [order(total.damage$billion, decreasing=TRUE),]


barplot (height = total.damage$billion[1:30], names.arg = total.damage$EVTYPE[1:30], las = 2, cex.names = 0.5,
         col = rainbow (30, start=0, end=1))
title ("Top 30 Events with Most Economic Damage")
title (ylab = "Total damage (billion USD)")

This bar graph shows the 30 events that caused the most economic damage, in descending order.

Results

From this analysis we see that ‘Tornado’ is the event that causes the most fatalities and injuries. However, economically a ‘Flood’ causes the most damage.