Synopsis

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.

This data analysis addresses which types of events are most harmful with respect to population health, as well as which types of events have the greatest economic consequences. Based on the analysis, tornadoes are the most damaging.

Data Processing

Reading data from the csv file

storm_data <- read.csv("repdata_data_StormData.csv.bz2")

Calculating and Sorting Health Impact

Total fatalities and injuries calculated by adding the corresponding columns. Data aggregated by combining health impact counts for each event type. Data sorted in decreasing order.

storm_data$fatalities_injuries <- storm_data$FATALITIES+storm_data$INJURIES
health_impact <- aggregate(fatalities_injuries~EVTYPE, storm_data, sum, na.rm=TRUE)
health_impact <- health_impact[order(health_impact$fatalities_injuries, decreasing = TRUE),]

Calculating Economic Impact

Economic impact calculated by multiplying all damage costs by the proper exponent.

storm_data$actual_propdmg <- storm_data$PROPDMG
storm_data$actual_cropdmg <- storm_data$CROPDMG
for (i in 1:nrow(storm_data)) {
  if (storm_data$PROPDMGEXP[i] == "K"){
    storm_data$actual_propdmg <- storm_data$PROPDMG*1000
  }else if(storm_data$PROPDMGEXP[i] == "M"){
    storm_data$actual_propdmg <- storm_data$PROPDMG*1000000
  }else if(storm_data$PROPDMGEXP[i] == "B"){
    storm_data$actual_propdmg <- storm_data$PROPDMG*1000000000
  }
  if (storm_data$CROPDMGEXP[i] == "K"){
    storm_data$actual_cropdmg <- storm_data$CROPDMG*1000
  }else if(storm_data$CROPDMGEXP[i] == "M"){
    storm_data$actual_cropdmg <- storm_data$CROPDMG*1000000
  }else if(storm_data$CROPDMGEXP[i] == "B"){
    storm_data$actual_cropdmg <- storm_data$CROPDMG*1000000000
  }
}

Sort Economic Impact

Total economic impact calculated by adding crop/property damage costs. Data by combining economic impact counts for each event type. Data sorted in decreasing order.

storm_data$total_econ_dmg <- storm_data$actual_cropdmg+storm_data$actual_propdmg
econ_impact <- aggregate(total_econ_dmg~EVTYPE, storm_data, sum, na.rm=TRUE)
econ_impact <- econ_impact[order(econ_impact$total_econ_dmg, decreasing = TRUE),]

Results

Health Impact Graph

It appears that tornadoes impact health the most.

library(ggplot2)
ggplot(health_impact[1:10,], aes(x=EVTYPE, y=fatalities_injuries)) + geom_bar(stat="identity") +
  labs(title="Top 10 Events by Health Impact", x="Event Type", y="Total Fatalities and Injuries")

# Economic Impact Graph It appears that tornadoes impact the economy the most.

ggplot(econ_impact[1:10,], aes(x=EVTYPE, y=total_econ_dmg)) + geom_bar(stat="identity") +
  labs(title="Top 10 Events by Economic Impact", x="Event Type", y="Total Property and Crop Damage")