The objective of this study was analised a Storm data documentation in order to find out what type of weather is most dangerous for human health and has the greatest economic consequences.
The report will show how Tornados are the most dangerous type of event, both economic and health wise. Heat are the second most harmful and floods the ones that give the greatest economics damages.
The data were collected from the course web site, and the documentation can be find at NATIONAL WEATHER SERVICE.
The code for loading the data is below:
setwd("C:/Users/Master/Desktop/PA_TESTE/")
data <- read.csv("repdata-data-StormData.csv")
A direct fatality or injury is defined as a fatality or injury directly attributable to the hydro-meteorological event itself, or impact by airborne/falling/moving debris, i.e.,missiles generated by wind, water, ice, lightning, tornado, etc. In these cases, the weather event was an “active” agent or generated debris which became an active agent. Generalized examples of direct fatalities/injuries would include:
-a. Thunderstorm wind gust causes a moving vehicle to roll over; -b. Blizzard winds topple a tree onto a person; and -c. Vehicle is parked on a road, adjacent to a dry arroyo. A flash flood comes down the arroyo and flips over the car. The driver drowns.
-Building the dataset that will be used:
Harmful<- data[,c(8,23,24,37)]
head(Harmful)
## EVTYPE FATALITIES INJURIES REFNUM
## 1 TORNADO 0 15 1
## 2 TORNADO 0 0 2
## 3 TORNADO 0 2 3
## 4 TORNADO 0 2 4
## 5 TORNADO 0 2 5
## 6 TORNADO 0 6 6
T_Missing <- sum(is.na(Harmful))
T_Missing
## [1] 0
-Understanding the dataset
Total_Injuries<- tapply(Harmful$INJURIES,Harmful$EVTYPE, sum, na.rm=TRUE)
Total_Fatalities<- tapply(Harmful$FATALITIES,Harmful$EVTYPE, sum, na.rm=TRUE)
Harmful$HARMFUL<- Harmful$INJURIES + Harmful$FATALITIES
Total_Harmful<- tapply(Harmful$HARMFUL,Harmful$EVTYPE, sum, na.rm=TRUE)
Total_Injuries<-Total_Injuries[order(-Total_Injuries)][c(1:5)]
Total_Fatalities<-Total_Fatalities[order(-Total_Fatalities)][c(1:5)]
Total_Harmful<-Total_Harmful[order(-Total_Harmful)][c(1:5)]
Property damage estimates should be entered as actual dollar amounts, if a reasonably accurate estimate from an insurance company or other qualified individual is available.
-Building the dataset that will be used:
Damage<- data[,c(8,25,27)]
head(Damage)
## EVTYPE PROPDMG CROPDMG
## 1 TORNADO 25.0 0
## 2 TORNADO 2.5 0
## 3 TORNADO 25.0 0
## 4 TORNADO 2.5 0
## 5 TORNADO 2.5 0
## 6 TORNADO 2.5 0
T_Missing <- sum(is.na(Damage))
T_Missing
## [1] 0
-Understanding the dataset
Total_Prop<- tapply(Damage$PROPDMG,Damage$EVTYPE, sum, na.rm=TRUE)
Total_Crop<- tapply(Damage$CROPDMG,Damage$EVTYPE, sum, na.rm=TRUE)
Damage$DAMAGE<- Damage$PROPDMG + Damage$CROPDMG
Total_Damage<- tapply(Damage$DAMAGE,Damage$EVTYPE, sum, na.rm=TRUE)
Total_Prop<-Total_Prop[order(-Total_Prop)][c(1:5)]
Total_Crop<-Total_Crop[order(-Total_Crop)][c(1:5)]
Total_Damage<-Total_Damage[order(-Total_Damage)][c(1:5)]
Tornados are the most harmful event (both injuries and fatalities), followed by Excessive Heat. In general we can assume 3 types of events that are most harmful across USA: Tornados and Winds, Heat, Flood and lightning.
barplot(Total_Harmful,
horiz=TRUE,
axisname=TRUE,
cex.names=0.5,
col=c("plum4",
"palevioletred4",
"lightpink3",
"mediumseagreen",
"limegreen"),
main="Total of Injuries + Fatalities by Event Type",
xlab="Total of Injuries + Fatalities")
Total_Harmful
## TORNADO EXCESSIVE HEAT TSTM WIND FLOOD LIGHTNING
## 96979 8428 7461 7259 6046
Total_Injuries
## TORNADO TSTM WIND FLOOD EXCESSIVE HEAT LIGHTNING
## 91346 6957 6789 6525 5230
Total_Fatalities
## TORNADO EXCESSIVE HEAT FLASH FLOOD HEAT LIGHTNING
## 5633 1903 978 937 816
Tornados are the event that has the greatest economic consequences (both properties and crop), followed by Flash Flood. In general we can assume 3 types of events that cause the greatest economic damages across USA: Tornados and Winds, Flood and Hail.
barplot(Total_Damage,
horiz=TRUE,
axisname=TRUE,
cex.names=0.5,
col=c("plum4",
"palevioletred4",
"lightpink3",
"mediumseagreen",
"limegreen"),
main="Total Damages (Prop + Crop) by Event Type",
xlab="Total Damages (Prop + Crop)")
Total_Prop
## TORNADO FLASH FLOOD TSTM WIND FLOOD
## 3212258.2 1420124.6 1335965.6 899938.5
## THUNDERSTORM WIND
## 876844.2
Total_Crop
## HAIL FLASH FLOOD FLOOD TSTM WIND TORNADO
## 579596.3 179200.5 168037.9 109202.6 100018.5
Total_Damage
## TORNADO FLASH FLOOD TSTM WIND HAIL FLOOD
## 3312277 1599325 1445168 1268290 1067976