Exploring the U.S. National Oceanic and Atmospheric Administration’s Storm Database.

Synopsis

This report contains the analysis of the U.S. National Oceanic and Atmospheric Administration’s storm database and tries to answer following two questions:

  • Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health?

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

Loading and Processing the Raw Data

Loading packages.

library(dplyr)
## Warning: package 'dplyr' was built under R version 3.6.3

Loading data

data<-read.csv("repdata_data_StormData.csv")
data2 <- data[,c('EVTYPE','FATALITIES','INJURIES', 'PROPDMG', 'PROPDMGEXP', 'CROPDMG', 'CROPDMGEXP')]

Getting top 5 worst weather events in term of fatalities

#Top 5 worst weather events in term of fatalities
aux<- data2 %>% 
  select(EVTYPE, FATALITIES)%>% 
  arrange(desc(FATALITIES))

aux<-aux[1:5,]

Getting top 5 worst weather events in term of injuries

#Top 5 worst weather events in term of injuries
aux11<- data2 %>% 
  select(EVTYPE, INJURIES)%>% 
  arrange(desc(INJURIES))

aux11<-aux11[1:5,]

Converting units to calculate Property and Crop Damages

data2$PROPDMGNUM = 0
data2[data2$PROPDMGEXP == "H", ]$PROPDMGNUM = data2[data2$PROPDMGEXP == "H", ]$PROPDMG * 10^2
data2[data2$PROPDMGEXP == "K", ]$PROPDMGNUM = data2[data2$PROPDMGEXP == "K", ]$PROPDMG * 10^3
data2[data2$PROPDMGEXP == "M", ]$PROPDMGNUM = data2[data2$PROPDMGEXP == "M", ]$PROPDMG * 10^6
data2[data2$PROPDMGEXP == "B", ]$PROPDMGNUM = data2[data2$PROPDMGEXP == "B", ]$PROPDMG * 10^9

data2$CROPDMGNUM = 0
data2[data2$CROPDMGEXP == "H", ]$CROPDMGNUM = data2[data2$CROPDMGEXP == "H", ]$CROPDMG * 10^2
data2[data2$CROPDMGEXP == "K", ]$CROPDMGNUM = data2[data2$CROPDMGEXP == "K", ]$CROPDMG * 10^3
data2[data2$CROPDMGEXP == "M", ]$CROPDMGNUM = data2[data2$CROPDMGEXP == "M", ]$CROPDMG * 10^6
data2[data2$CROPDMGEXP == "B", ]$CROPDMGNUM = data2[data2$CROPDMGEXP == "B", ]$CROPDMG * 10^9

Adding up the total damage.

damages <- aggregate(PROPDMGNUM + CROPDMGNUM ~ EVTYPE, data=data2, sum)
names(damages)[2]<-"total"

Getting the Top 5 worst weather events in term of Property & Crop Damages

aux2<- damages %>% 
  arrange(desc(total))

aux2<-aux2[1:5,]
aux2$total<-aux2$total/10^9

Results

1 Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health?

par(mar=c(10, 4.1, 4.1, 2.1))
barplot(aux$FATALITIES, names.arg =aux$EVTYPE, las=2,
        main="Top 5 worst weather events in term of fatalities.",ylab="Fatalities",
        col = rainbow(5))

The plot shows Heat and Tornado are the most destructive events in term of fatalities.

par(mar=c(8, 4.1, 4.1, 2.1))
barplot(aux11$INJURIES, names.arg =aux11$EVTYPE, las=2,
        main="Top 5 worst weather events in term of injuries.",ylab="Injuries",
        col = rainbow(5))

The plot shows Tornado and Ice Storm are the most destructive events in term of injuries.

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

par(mar=c(12, 5.1, 4.1, 2.1))
barplot(aux2$total, names.arg =aux2$EVTYPE, las=2,
        main="Top 5 worst weather events in term of Property & Crop Damages",ylab="Damages(Billions Of Dollars)",
        col = rainbow(5))

The plot shows Flood is most destructive event in term of Property & Crop.