1. 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 database is located here.
The events in the database start in the year 1950 and end in November 2011. In the earlier years of the database there are generally fewer events recorded, most likely due to a lack of good records. More recent years should be considered more complete.
An analysis of this data will aim to address the following:
- Across the United States, which types of events are most harmful with respect to population health?
- Across the United States, which types of events have the greatest economic consequences?

 

2. Data Processing

 

Data are downloaded and unzipped from the given URL for processing. Data are read and loaded into a dataframe.
if(!file.exists("./storm_data")){dir.create("./storm_data")}
fileUrl <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
download.file(fileUrl,destfile="./storm_data/storms.bz2",method="curl")
storm_data <- read.csv("./storm_data/storms.bz2")

 

3. Results

 

3.1 Across the United States, which types of events are most harmful with respect to population health?

 

The dataframe from Section 2 is reduced down to only necessary columns to reduce computation.

storm_data_health <- storm_data[,c('EVTYPE','FATALITIES', 'INJURIES')]
Fatalities and injuries are summed up by weather event and reduced to the top 10 leading causes.
fatalities_event <- aggregate(FATALITIES ~ EVTYPE,data = storm_data_health, sum)
fatalities_event <- fatalities_event[order(fatalities_event$FATALITIES, decreasing = TRUE),][1:10,]
fatalities_event$FATALITIES <- fatalities_event$FATALITIES/1000 
injuries_event <- aggregate(INJURIES ~ EVTYPE,data = storm_data_health, sum)
injuries_event <- injuries_event[order(injuries_event$INJURIES, decreasing = TRUE),][1:10,]
injuries_event$INJURIES <- injuries_event$INJURIES/1000 
A plot of the top ten causes of fatalities and injuries by weather event in the US from 1950-2011 is given below.
par(mfrow=c(1,2))
par(mar = c(8,5,2,1), las = 2)
barplot(fatalities_event$FATALITIES, names.arg = fatalities_event$EVTYPE, 
        main = 'Fatalities by Weather Event', ylab ='Total Fatalities (1950-2011) / 1000s ', las =2, col = 'firebrick', cex.names  =  0.7)
barplot(injuries_event$INJURIES, names.arg = injuries_event$EVTYPE, 
        main = 'Injuries by Weather Event', ylab = 'Total Injuries (1950-2011) / 1000s', las = 2, col = 'blue', cex.names  = 0.7)

3.2. Across the United States, which types of events have the greatest economic consequences?

 

To answer the second question the dataframe produced in section 2 is reduced down again to only the required columns to reduce computation.
storm_data_damage <- storm_data[,c('EVTYPE','PROPDMG', 'PROPDMGEXP', 'CROPDMG', 'CROPDMGEXP')]

 

3.2.1 Property Damage

The data consists of two columns giving values and exponent values. Firstly the unique exponent values in the property damage data are found. Using the these the property damage amounts are calculated by coverting the unique exponent codes and multiplying witht the property damage values.
#find unique exponents
print(unique(storm_data_damage$PROPDMGEXP))
##  [1] "K" "M" ""  "B" "m" "+" "0" "5" "6" "?" "4" "2" "3" "h" "7" "H" "-" "1" "8"
#assign values for the property exponent storm_data_damage 
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "B"] <- 1e+09
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "M"] <- 1e+06
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "m"] <- 1e+06
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "K"] <- 1000
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "H"] <- 100
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "h"] <- 100
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "8"] <- 1e+08
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "7"] <- 1e+07
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "6"] <- 1e+06
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "5"] <- 1e+05
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "4"] <- 10000
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "3"] <- 1000
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "2"] <- 100
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "1"] <- 10
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "0"] <- 1
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == ""] <- 0
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "+"] <- 1
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "-"] <- 0
storm_data_damage$PROPEXP[storm_data_damage$PROPDMGEXP == "?"] <- 0

#calculate total property damage costs 
storm_data_damage$PROPDMGVALUE <- storm_data_damage$PROPEXP*storm_data_damage$PROPDMG
Calculate property damage costs (in billions of dollars) by weather event and reduce to the top 10.
#calculate property damage by weather event
prop_dam_event <- aggregate(PROPDMGVALUE ~ EVTYPE,data = storm_data_damage, sum)
#order and reduce dataset to top 10
prop_dam_event <- prop_dam_event[order(prop_dam_event$PROPDMGVALUE, decreasing = TRUE),][1:10,]
#re-scale to billions of dollars
prop_dam_event$PROPDMGVALUE <- prop_dam_event$PROPDMGVALUE/1e9

 

3.2.2 Crop Damage

Similar to the data in Section 3.2.1 the data consists of two columns giving values and exponent values. Firstly the unique exponent values in the crop damage data are found. Using the these the crop damage amounts are calculated by coverting the unique exponent codes and multiplying witht the crop damage values.
#find unique exponents
print(unique(storm_data_damage$CROPDMGEXP))
## [1] ""  "M" "K" "m" "B" "?" "0" "k" "2"
#assign values for the property exponent storm_data_damage 
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == "B"] <- 1e+09
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == "M"] <- 1e+06
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == "m"] <- 1e+06
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == "K"] <- 1000
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == "k"] <- 1000
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == "2"] <- 100
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == "0"] <- 1
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == "?"] <- 0
storm_data_damage$CROPEXP[storm_data_damage$CROPDMGEXP == ""] <- 0

#calculate total property damage costs 
storm_data_damage$CROPDMGVALUE <- storm_data_damage$CROPEXP*storm_data_damage$CROPDMG
Calculate crop damage costs (in billions of dollars) by weather event and reduce to the top 10.
#calculate crop damage by weather event
crop_dam_event <- aggregate(CROPDMGVALUE ~ EVTYPE,data = storm_data_damage, sum)
#order and reduce dataset to top 10
crop_dam_event <- crop_dam_event[order(crop_dam_event$CROPDMGVALUE, decreasing = TRUE),][1:10,]
#re-scale to billions of dollars
crop_dam_event$CROPDMGVALUE <- crop_dam_event$CROPDMGVALUE/1e9

 

3.3 Data Visualization

A plot of the top ten most expensive weather events in the US from 1950-2011 by total damage to property and crops is generated.
par(mfrow=c(1,2))
par(mar = c(8,5,2,1), las = 2)
barplot(prop_dam_event$PROPDMGVALUE, names.arg = prop_dam_event$EVTYPE, 
        main = 'Property Damage costs \n by Weather Event', ylab ='Total Cost (1950-2011) / Billion $', las =2, col = 'darkgreen', cex.names  =  0.7)
barplot(crop_dam_event$CROPDMGVALUE, names.arg = crop_dam_event$EVTYPE, 
        main = 'Crop Damage costs \n by Weather Event', ylab = 'Total Cost (1950-2011) / Billion $', las = 2, col = 'gold1', cex.names  = 0.7)

4. Summary

 

From an analysis of the data, the leading cause of fatalities and injuries in the US from 1950-2011 was tornadoes.