Title: Tornadoes, thunderstorm winds, floods and excessive heat are the most harmful events to human health while flood, hurricane, tornado, storm surge and hail have the direst economic consequences.

Synopsis

Severe weather events cause not only health related problems but can have great econimic consequences. We derived data from U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database and we examine the types of events that are most harmful with respect to population health , and yet which types of events have the the greatest economic consequences

Data processing

An analysis of how different types of natural events have impact on human health and property damage.

library(dplyr)
## Warning: package 'dplyr' was built under R version 3.2.5
## 
## 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
data <- read.csv("file:///C:/Users/skoutavidi001/Documents/coursera/Reproducible2/repdata-data-StormData.csv")
head(data)
##   STATE__           BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE
## 1       1  4/18/1950 0:00:00     0130       CST     97     MOBILE    AL
## 2       1  4/18/1950 0:00:00     0145       CST      3    BALDWIN    AL
## 3       1  2/20/1951 0:00:00     1600       CST     57    FAYETTE    AL
## 4       1   6/8/1951 0:00:00     0900       CST     89    MADISON    AL
## 5       1 11/15/1951 0:00:00     1500       CST     43    CULLMAN    AL
## 6       1 11/15/1951 0:00:00     2000       CST     77 LAUDERDALE    AL
##    EVTYPE BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END
## 1 TORNADO         0                                               0
## 2 TORNADO         0                                               0
## 3 TORNADO         0                                               0
## 4 TORNADO         0                                               0
## 5 TORNADO         0                                               0
## 6 TORNADO         0                                               0
##   COUNTYENDN END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES
## 1         NA         0                      14.0   100 3   0          0
## 2         NA         0                       2.0   150 2   0          0
## 3         NA         0                       0.1   123 2   0          0
## 4         NA         0                       0.0   100 2   0          0
## 5         NA         0                       0.0   150 2   0          0
## 6         NA         0                       1.5   177 2   0          0
##   INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES
## 1       15    25.0          K       0                                    
## 2        0     2.5          K       0                                    
## 3        2    25.0          K       0                                    
## 4        2     2.5          K       0                                    
## 5        2     2.5          K       0                                    
## 6        6     2.5          K       0                                    
##   LATITUDE LONGITUDE LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1     3040      8812       3051       8806              1
## 2     3042      8755          0          0              2
## 3     3340      8742          0          0              3
## 4     3458      8626          0          0              4
## 5     3412      8642          0          0              5
## 6     3450      8748          0          0              6
data$EVTYPE = toupper(data$EVTYPE)
Data_names=names(data)

Next steps is the tranformation of event types to get unique names throughout our analysis according to guidelines

Results

FATALITIES and INJURIES are both related with human health so we present them in decreasing order

Harmful_Events <- aggregate(FATALITIES ~ EVTYPE, data = data, sum)
Harmful_Events_SUM<-Harmful_Events[Harmful_Events$FATALITIES>0,]
Harmful_Order<- Harmful_Events_SUM[order(Harmful_Events_SUM$FATALITIES,decreasing=TRUE),]
head(Harmful_Order)
##                EVTYPE FATALITIES
## 755           TORNADO       5633
## 116    EXCESSIVE HEAT       1903
## 138       FLASH FLOOD        978
## 243              HEAT        937
## 417         LIGHTNING        816
## 683 THUNDERSTORM WIND        701
Injuries_Events <- aggregate(INJURIES ~ EVTYPE, data = data, sum)
Injuries_Events_SUM<-Injuries_Events[Injuries_Events$INJURIES>0,]
Injuries_Order<- Injuries_Events_SUM[order(Injuries_Events_SUM$INJURIES,decreasing=TRUE),]
head(Injuries_Order)
##                EVTYPE INJURIES
## 755           TORNADO    91346
## 683 THUNDERSTORM WIND     9353
## 154             FLOOD     6791
## 116    EXCESSIVE HEAT     6525
## 417         LIGHTNING     5230
## 243              HEAT     2100

Utilizing the above analysis we depict 2 plots indicating top 10 events causing more Fatalities and Injuries respectively

barplot(Harmful_Order[1:10, 2], col = heat.colors(10), legend.text = Harmful_Order[1:10, 
       1], ylab = "Fatality", main = "Top 10 events causing most fatalities")

barplot(Injuries_Order[1:10, 2], col = heat.colors(10), legend.text = Injuries_Order[1:10, 
      1], ylab = "Injury", main = "Top 10 events causing most injuries")

Next thing to be determined is which events cause both Fatalies and Injuries

intersect(Harmful_Order[1:10,1],Injuries_Order[1:10,1])
## [1] "TORNADO"           "EXCESSIVE HEAT"    "FLASH FLOOD"      
## [4] "HEAT"              "LIGHTNING"         "THUNDERSTORM WIND"
## [7] "FLOOD"

Result 1:

From 7 major types of events listed in the top 10 causes of fatalities and body injuries, tornadoes are the most harmful event to human health while others like exccesive heat, flash flood, and thunderstorm wind area come next.

Property most harmful events

We examine the uniqueness of property of most harmful events

unique(data$PROPDMGEXP)
##  [1] K M   B m + 0 5 6 ? 4 2 3 h 7 H - 1 8
## Levels:  - ? + 0 1 2 3 4 5 6 7 8 B h H K m M
unique(data$CROPDMGEXP)
## [1]   M K m B ? 0 k 2
## Levels:  ? 0 2 B k K m M

Transformation is required according to guidelines in order to be able to have accurate Total results , as follows: 1) “K” stands for Thousands 2) “M” stands for Millions 3) “B” stands for Billions

{ r transformations2} data[data$PROPDMGEXP == "K", ]$PROPDMG <- data[data$PROPDMGEXP == "K", ]$PROPDMG * 1000 data[data$PROPDMGEXP == "M", ]$PROPDMG <- data[data$PROPDMGEXP == "M", ]$PROPDMG * 1e+06 data[data$PROPDMGEXP == "m", ]$PROPDMG <- data[data$PROPDMGEXP == "m", ]$PROPDMG * 1e+06 data[data$PROPDMGEXP == "B", ]$PROPDMG <- data[data$PROPDMGEXP == "B", ]$PROPDMG * 1e+09 data[data$CROPDMGEXP == "K", ]$CROPDMG <- data[data$CROPDMGEXP == "K", ]$CROPDMG * 1000 data[data$CROPDMGEXP == "k", ]$CROPDMG <- data[data$CROPDMGEXP == "k", ]$CROPDMG * 1000 data[data$CROPDMGEXP == "M", ]$CROPDMG <- data[data$CROPDMGEXP == "M", ]$CROPDMG * 1e+06 data[data$CROPDMGEXP == "m", ]$CROPDMG <- data[data$CROPDMGEXP == "m", ]$CROPDMG * 1e+06 data[data$CROPDMGEXP == "B", ]$CROPDMG <- data[data$CROPDMGEXP == "B", ]$CROPDMG *1e+09

Property and Crop damage type of events are aggregated and ordered respectively

Property_damage <- aggregate(PROPDMG ~ EVTYPE, data = data, sum)
Property_damage_Pos<- Property_damage[Property_damage$PROPDMG>0,]
Property_damage_Order<- Property_damage_Pos[order(Property_damage_Pos$PROPDMG, decreasing = TRUE), ]

Crop_damage_Total <- aggregate(CROPDMG ~ EVTYPE, data = data, sum)
Crop_damage_Total_Pos<- Crop_damage_Total[Crop_damage_Total$CROPDMG>0,]
Cop_damage_Total_Order<- Crop_damage_Total_Pos[order(Crop_damage_Total_Pos$CROPDMG, decreasing = TRUE), ]

A Total is calculated by mergning these 2 together

Total_damage <- merge(Property_damage_Order, Cop_damage_Total_Order, by = "EVTYPE")
Total_damage$Total<- Total_damage$PROPDMG+Total_damage$CROPDMG
Total_damage_Order<- Total_damage[order(Total_damage$Total, decreasing = TRUE), ]

A plot is showing top 5 natural events causing major economic consequences

barplot(Total_damage_Order[1:5, 2], col = terrain.colors(5), legend.text = Total_damage_Order[1:5, 
         1], ylab = "Damage", main = "5 natural events causing major economic consequences")

Result 2: Flood , turricane, tornado , storm surge and haail are the 5 natural events causing major economic consequences

Final Results

Across the United States, which types of events (as indicated in the EVTYPE variable) are most harmful with respect to population health? TORNADO ,EXCESSIVE HEAT,FLASh FLOOD,HEAT and LIGHTNING.

Across the United States, which types of events have the greatest economic consequences? FLOOD ,HURRICANE-TYPHOON,TORNADO,STORM SURGE and HAIL.