TITLE

EFFECTS OF WEATHER EVENTS ON PEOPLE AND PROPERTY

In this analysis, we examine what types of storm events have the greatest impact in terms of property damage, injuries and deaths.

DATA TRANSFORMATIONS

The original data defined 984 storm events. Some of these were misspelling of others and some were closely related in concept. To simplify the presentation, we group many of the event types based on similarities in the names. The 984 original event types were reduced to 4: ICE, TORNADO, HAIL and OTHER. Any EVTYPEs having those strings embedded in their name were grouped together. If an EVTYPE had more than one of the 3 listed events, the priority was HAIL, TORNADO, ICE,

The source of the data is the National Weather Service Storm Data.

DATA PROCESSING

Data were read directly from the NOAA site using the read.csv command

DATA ANALYSIS EVTYPES (of the collapsed names) were summed. Percentages of the whole were calculated. Pie charts were constructed.

  library(dplyr)
## Warning: package 'dplyr' was built under R version 4.0.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
  # read input file
  table1<-read.csv("C:/Users/Samford/tmpdir/reproducible week4/repdata_data_StormData.csv.bz2")
  
  table1$EV1<-ifelse(grepl("WIND",table1$EVTYPE,fixed=TRUE),"WIND",
                     ifelse(grepl("RAIN",table1$EVTYPE,fixed=TRUE),"RAIN/SNOW/ICE",
                            
                  
                            ifelse(grepl("ICE",table1$EVTYPE,fixed=TRUE),"RAIN/SNOW/ICE",
                                   ifelse(grepl("TORNADO",table1$EVTYPE,fixed=TRUE),"TORNADO",
                                          ifelse(grepl("HAIL",table1$EVTYPE,fixed=TRUE),"RAIN/SNOW/ICE","OTHER")
                                   ))))
  sum_ev<-table1 %>%
    group_by(EV1)%>%summarize(sum_inj=sum(INJURIES),sum_ftl=sum(FATALITIES),
                              sum_dmg=sum(PROPDMG),n=n())
## `summarise()` ungrouping output (override with `.groups` argument)
  sum_ev$per_inj<-round(sum_ev$sum_inj/sum(sum_ev$sum_inj)*100,1)
  sum_ev$per_ftl<-round(sum_ev$sum_ftl/sum(sum_ev$sum_ftl)*100,1)
  sum_ev$per_dmg<-round(sum_ev$sum_dmg/sum(sum_ev$sum_dmg)*100,1)
  totinj=sum(table1$INJURIES)
  totftl=sum(table1$FATALITIES)
  totdmg=sum(table1$PROPDMG)
  
  par(mfrow=c(3,1),mar=c(4,4,2,1))
  pie(sum_ev$sum_inj,labels=sum_ev$per_inj,
      main="PERCENT INJURIES BY EVENT TYPE",col=rainbow(length(sum_ev$sum_inj)))
  legend("topright",c("OTHER","RAIN/SNOW/ICE","TORNADO","WIND"),
         cex=0.8, fill=rainbow(length(sum_ev$sum_inj)))
  mtext(paste("Total Injuries ",as.character(totinj)), side=1,cex=0.7)
  
  pie(sum_ev$sum_ftl,labels=sum_ev$per_ftl,
      main="PERCENT FATALITIES BY EVENT TYPE",col=rainbow(length(sum_ev$sum_ftl)))
  legend("topright",c("OTHER","RAIN/SNOW/ICE","TORNADO","WIND"),
         cex=0.8,fill=rainbow(length(sum_ev$sum_inj)))
  mtext(paste("Total Fatalities ",as.character(totftl)), side=1,cex=0.7)
   
  pie(sum_ev$sum_dmg,labels=sum_ev$per_dmg,
      main="PERCENT DAMAGE BY EVENT TYPE",col=rainbow(length(sum_ev$sum_ftl)))
  legend("topright",c("OTHER","RAIN/SNOW/ICE","TORNADO","WIND"),
         cex=0.8,fill=rainbow(length(sum_ev$sum_inj)))
  mtext(paste("Total Property Damage ",as.character(totdmg)), side=1,cex=0.7)

RESULTS

We see that the EVENTTYPE “TORNADO” is by a wide margin the most damaging event type across Injuries, Fatalities and Dollar Damage