## Synopsis

In the US there are many natural events that take place. Those events have big consequences in the country. In this analysis it is going to be shown the events that are the most dangerous and those that have the biggest repercussions.

## The most dangerous events

There are many natural events that take place, but there are some that causes more fatalities and injuries on people than others. First we are going to look at the events with the most fatalities and then those with most injured people. First the data is downloaded, extracted and put into a data set to be analyzed. Then the amount fatalities are summed by type of event, the same it is done with the amount of injuries.

data<-read.csv("data.bz2",header = TRUE)

totalFataliities<-aggregate(FATALITIES~EVTYPE,data,sum)
totalFataliities<-totalFataliities[order(-totalFataliities$FATALITIES),][1:5,] totalInjuries<-aggregate(INJURIES~EVTYPE,data,sum) totalInjuries <- totalInjuries[order(-totalInjuries$INJURIES), ][1:5,]

totalFataliities
##             EVTYPE FATALITIES
## 130 EXCESSIVE HEAT       1903
## 153    FLASH FLOOD        978
## 275           HEAT        937
## 464      LIGHTNING        816
totalInjuries
##             EVTYPE INJURIES
## 856      TSTM WIND     6957
## 170          FLOOD     6789
## 130 EXCESSIVE HEAT     6525
## 464      LIGHTNING     5230

It can be seen that tornados are the main cause of fatalities when it comes to natural disasters. But tornados are also the natural disasters that leaves most injured people. So naturally, tornados are the events that cause the most damage to people (death and injuries)

## The most costly events

Natural disasters not only affect people with injuries and death, they also leave damage to property and crops. These damages can affect more people in more indirect ways, but this type of damages can be even more sever for people as society. We are going to see the amount of economical damage that these disasters leave in property and crop damage. First it is needed to extract the amount of property damage and crop damage by type of event in dollars that the events cause.

library(ggplot2)
options(scipen=999)

totalPropDMG<-aggregate(PROPDMG~EVTYPE,data,sum)
totalPropDMG <- totalPropDMG[order(-totalPropDMG$PROPDMG), ][1:5, ] totalCropDMG<-aggregate(CROPDMG~EVTYPE,data,sum) totalCropDMG<-totalCropDMG[order(-totalCropDMG$CROPDMG),][1:5,]

totalPropDMG
##                EVTYPE   PROPDMG
## 153       FLASH FLOOD 1420124.6
## 856         TSTM WIND 1335965.6
## 170             FLOOD  899938.5
## 760 THUNDERSTORM WIND  876844.2
ggplot(totalPropDMG,aes(EVTYPE,PROPDMG))+geom_col(col="purple4")+
ggtitle("Top 5 event types that causes the most damage of propeties in dollars")+
xlab("Event Type")+ylab("Total damage to property in dollars")

totalCropDMG
##          EVTYPE  CROPDMG
## 244        HAIL 579596.3
## 153 FLASH FLOOD 179200.5
## 170       FLOOD 168037.9
## 856   TSTM WIND 109202.6
## 834     TORNADO 100018.5
ggplot(totalCropDMG,aes(EVTYPE,CROPDMG))+geom_col(col="purple4")+
ggtitle("Total fatalities by type of event")+xlab("Event Type")+
xlab("Event Type")+ylab("Total damage to Crops in dollars")

totalDMG<-sum(totalPropDMG$PROPDMG)+sum(totalCropDMG$CROPDMG)
totalDMG
## [1] 8881187

It can be seen that tornados are the natural disaster with the most damages to property with over 3 millions of dollars. Then it is seen in the next graph that hails are by far (compared to other events) the event that cause the most damage to crops. If we combine the both, property damage and crop damage, we can see that natural disasters have left damages worth more than 9 millions dollars.

## Results

In this analysis we have seen the damages that natural events can leave behind them. It is clear that some natural events causes more damage than others. It can also be seen that some cause more damage to people (death and injuries) and others have more economical damage.