title: “Storm report: consequences to human health and the economy” author: “D.Dashinov” date: “10/25/2020” output: html_document

##Synopsis The NOAA Storm Database contains a total of 902297 observations. The data set contains records for a 61-year period – between 1950 and 2011. The data is categorized by event types and there is information on the number of injuries and number of deaths due to a storm event. Also there is a variable that measures the property damage for each event. For the effects on human health the number of injuries and number of deaths were computed as means per event type. The highest mean number of deaths in the data set were due to Tornadoes (mean of 25 deaths), followed by Cold and snow (mean of 14 deaths). The ** Tropical Storm Gordon ** came in third with a mean of 8 deaths, however this event type had the greatest mean number of injuries – a mean of 43. To estimate the storm event with the highest impact on the US economy the data was grouped by Event type filtered for only the records which were estimated in millions of dollars (“M”). The event bearing greatest economic consequences for the US was Wild Fires (over 300 million dollars in damage), followed by Typhoons (about 150 million dollars). To conclude different storm events have highest consequence for human health and for the economy.

Data analisys

The data was downloaded on 25.01.2020 via the following link: link

StormData <- read.csv("repdata_data_StormData.csv")

To clean up and sort the data the dlyr package was loaded. The ggplot package was loaded for plotting.

library(ggplot2)
library(dplyr)
## 
## 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

In order to group the data the EVTYPE variable was set as a factor.

StormData$EVTYPE <- as.factor(StormData$EVTYPE)

Data analysis for human health impacts

The data was grouped by event type and the mean number of fatalities(deaths) and the mean number of injuries were calculated. Then the data was arranged in descending order first by the number of deaths, then by the number of injuries.

StromPH <- StormData %>% group_by(EVTYPE) %>% 
        summarise(MeanF = mean(FATALITIES, na.rm = T), MeanInj = mean(INJURIES, na.rm = T)) %>% 
        filter(MeanF > 0) 
## `summarise()` ungrouping output (override with `.groups` argument)
StormPHsorted <- arrange(StromPH, desc(MeanF, MeanInj)) 

Data analysis for impact on the economy

Here again the data was grouped by event type, and filtered by the property damage which excided 1 million dollars. Then the mean of the property damage was calculated and data was arranged by that mean.

DangStormData <- StormData %>% group_by(EVTYPE) %>% filter(PROPDMGEXP == 'M')

GroupedStorm <- DangStormData %>% group_by(EVTYPE) %>% summarise(MeanDMG = mean(PROPDMG, na.rm = T))
## `summarise()` ungrouping output (override with `.groups` argument)
TopStomrDMG <- arrange(GroupedStorm, desc(MeanDMG))

Results

Impacts on human health

The highest mean number of deaths in the data set were due to Tornadoes (mean of 25 deaths), followed by Cold and snow (mean of 14 deaths). The ** Tropical Storm Gordon ** came in third with a mean of 8 deaths, however this event type had the greatest mean number of injuries – a mean of 43.

head(StormPHsorted)
## # A tibble: 6 x 3
##   EVTYPE                     MeanF MeanInj
##   <fct>                      <dbl>   <dbl>
## 1 TORNADOES, TSTM WIND, HAIL 25       0   
## 2 COLD AND SNOW              14       0   
## 3 TROPICAL STORM GORDON       8      43   
## 4 RECORD/EXCESSIVE HEAT       5.67    0   
## 5 EXTREME HEAT                4.36    7.05
## 6 HEAT WAVE DROUGHT           4      15

##Impacts on the economy The mean property damage was ploted for the top 10 storm events. The event bearing greatest economic consequences for the US was Wild Fires (over 300 million dollars in damage), followed by Typhoons (about 150 million dollars).

Top10DMG <- TopStomrDMG[1:10,]

q <- ggplot(Top10DMG, aes(x = EVTYPE, y = MeanDMG, group = 1)) + 
        geom_line(color = "red")

q + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) + 
        ylab("Mean DMG in millions of dollars") + 
        scale_x_discrete(limits = Top10DMG$EVTYPE, name = "Event type")