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 report shows the top ten storm types with the highest fatalities, injuries, property damage, and crop damage. It shows plots for each of the top ten storm types in each category.

Data Processing

Load Data Data is loaded from the Storm Data csv file into StormData

StormData then is reduced to DamageData with only the columns with the relevent data for calculating fatalities, injusries, property damage, and crop damage with storm types.

setwd("C:/Users/Mike/Documents/testdir/Repdata")
StormData <- read.csv(file="repdata_data_StormData.csv")
DamageData <- 
  StormData[,c("EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "CROPDMG")]

Storm’s Effect on Health

Storms have an effect on Health. Here the top ten highest total number of fatalities and injuries by Storm Type.

The total storm damage to crops and property is calculated by storm type and then the top ten storm types are selected.

 FatalData <-  aggregate(DamageData$FATALITIES,by=list(DamageData$EVTYPE),FUN=sum,na.rm=TRUE)
        colnames(FatalData) = c("StormType", "TotalFatalities")  
        FatalSort <- FatalData[order(-FatalData$TotalFatalities),]
        BigFatal <- FatalSort[1:10,]

    InjuryData <-  aggregate(DamageData$INJURIES,by=list(DamageData$EVTYPE),FUN=sum,na.rm=TRUE)
        colnames(InjuryData) = c("StormType", "TotalInjuries")  
        InjurySort <- InjuryData[order(-InjuryData$TotalInjuries),]
        BigInjury <- InjurySort[1:10,]

Storm Damage to Property and Crops

Here the same data processing used above with Fatalities and Injuries is used with Damage to Property and Crops

The total storm damage to crops and property is calculated by storm type and then the top ten storm types are selected.

    PropData <-  aggregate(DamageData$PROPDMG,by=list(DamageData$EVTYPE),FUN=sum,na.rm=TRUE)
        colnames(PropData) = c("StormType", "TotalPropDmg")  
        PropSort <- PropData[order(-PropData$TotalPropDmg),]
        BigPropDmg <- PropSort[1:10,]

    CropData <-  aggregate(DamageData$CROPDMG,by=list(DamageData$EVTYPE),FUN=sum,na.rm=TRUE)
        colnames(CropData) = c("StormType", "TotalCropDmg")  
        CropSort <- CropData[order(-CropData$TotalCropDmg),]
        BigCropDmg <- CropSort[1:10,]

Results

Here are the plots of the top ten fatalities and injuries by Storm Type

colors = c("red", "yellow", "green", "violet", "orange", "blue", "pink", "cyan", "brown", "purple")

par(mfrow = c(1, 2), mar = c(12, 4, 3, 2), mgp = c(3, 1, 0), cex = 0.8)
barplot(BigFatal$TotalFatalities, las = 3, names.arg = BigFatal$StormType, 
        main = "Storms with Most Fatalities", ylab = "Total Fatalities", 
        col = colors)

barplot(BigInjury$TotalInjuries, las = 3, names.arg = BigInjury$StormType, 
        main = "Storms with Most Injuries", ylab = "Total Injuries", 
        col = colors)

Here are plots of the top ten property damage and crop damage by Storm Type

par(mfrow = c(1, 2), mar = c(12, 4, 3, 2), mgp = c(3, 1, 0), cex = 0.8)
barplot((BigPropDmg$TotalPropDmg/(10^3)), las = 3, names.arg = BigPropDmg$StormType, 
        main = "Storms with Most Property Damage", ylab = "Damage Cost ($ Billions)", 
        col = colors)

barplot((BigCropDmg$TotalCropDmg/(10^3)), las = 3, names.arg = BigCropDmg$StormType, 
        main = "Storms with Most Crop Damage", ylab = "Damage Cost ($ Billions)", 
        col = colors)