Sergio Vicente Simioni
Monday, April 20, 2015
Storms and other severe weather events can cause both public health and economic problems for communities and municipalities. Many severe events can result in fatalities, injuries, and property damage, and preventing such outcomes to the extent possible is a key concern.
This project involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. This database tracks characteristics of major storms and weather events in the United States, including when and where they occur, as well as estimates of any fatalities, injuries, and property damage. Data
The events in the database start in the year 1950 and end in November 2011.
library(dplyr)
library(ggplot2)
library(knitr)
repdata_data_StormData.csv <- read.csv("C:/Users/Sergio Simioni/Desktop/Data_Science/Reproducible_Research/Peer_Assessment_2/repdata_data_StormData.csv.bz2")
storm_damage <- select(repdata_data_StormData.csv, BGN_DATE,STATE, EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP,CROPDMG,CROPDMGEXP)
* in order to eliminate the wrong inputs in PROPDMGEXP and CROPDMGEXP, it was created additional columns with zero and added values only for the letters H = Hundred, K = Thousands M = Millions and B = Billions
storm_damage$PROP_US <- 0
storm_damage$CROP_US <- 0
storm_damage$damage <- 0
storm_damage$health <- 0
storm_damage$PROP_US <- ifelse(storm_damage$PROPDMGEXP =="H" | storm_damage$PROPDMGEXP =="h",
storm_damage$PROPDMG*0.0000001, storm_damage$PROP_US)
storm_damage$CROP_US <- ifelse(storm_damage$CROPDMGEXP =="H"| storm_damage$CROPDMGEXP =="h",
storm_damage$CROPDMG*0.0000001, storm_damage$CROP_US)
storm_damage$PROP_US <- ifelse(storm_damage$PROPDMGEXP =="K"| storm_damage$PROPDMGEXP =="k",
storm_damage$PROPDMG*0.000001, storm_damage$PROP_US)
storm_damage$CROP_US <- ifelse(storm_damage$CROPDMGEXP =="K"| storm_damage$CROPDMGEXP =="k",
storm_damage$CROPDMG*0.000001, storm_damage$CROP_US)
storm_damage$PROP_US <- ifelse(storm_damage$PROPDMGEXP =="M"| storm_damage$PROPDMGEXP =="m",
storm_damage$PROPDMG*0.001, storm_damage$PROP_US)
storm_damage$CROP_US <- ifelse(storm_damage$CROPDMGEXP =="M"| storm_damage$CROPDMGEXP =="m",
storm_damage$CROPDMG*0.001, storm_damage$CROP_US)
storm_damage$PROP_US <- ifelse(storm_damage$PROPDMGEXP =="B"| storm_damage$PROPDMGEXP =="b",
storm_damage$PROPDMG*1, storm_damage$PROP_US)
storm_damage$CROP_US <- ifelse(storm_damage$CROPDMGEXP =="B"| storm_damage$CROPDMGEXP =="b",
storm_damage$CROPDMG*1, storm_damage$CROP_US)
storm_damage$health <- storm_damage$FATALITIES + storm_damage$INJURIES
storm_damage$damage <- storm_damage$PROP_US + storm_damage$CROP_US
health <- aggregate(storm_damage$health, by=list(storm_damage$EVTYPE), FUN = sum)
health <- arrange(health, desc(x))
health <- head(health,10)
health <- transform( health, Group.1 = reorder(Group.1, order(x, decreasing =TRUE)))
health <- select(health, Event_Type = Group.1, Number_of_Injuries= x)
storm_PDMG <- aggregate(storm_damage$damage, by=list(storm_damage$EVTYPE), FUN = sum)
storm_PDMG <- arrange(storm_PDMG, desc(x))
storm_PDMG <- head(storm_PDMG,10)
storm_PDMG <- transform( storm_PDMG, Group.1 = reorder(Group.1, order(x, decreasing =TRUE)))
storm_PDMG <- select(storm_PDMG, Event_Type = Group.1, Economic_Impact= x)
head(health,10)
## Event_Type Number_of_Injuries
## 1 TORNADO 96979
## 2 EXCESSIVE HEAT 8428
## 3 TSTM WIND 7461
## 4 FLOOD 7259
## 5 LIGHTNING 6046
## 6 HEAT 3037
## 7 FLASH FLOOD 2755
## 8 ICE STORM 2064
## 9 THUNDERSTORM WIND 1621
## 10 WINTER STORM 1527
head(storm_PDMG,10)
## Event_Type Economic_Impact
## 1 FLOOD 150.319678
## 2 HURRICANE/TYPHOON 71.913713
## 3 TORNADO 57.352114
## 4 STORM SURGE 43.323541
## 5 HAIL 18.758222
## 6 FLASH FLOOD 17.562129
## 7 DROUGHT 15.018672
## 8 HURRICANE 14.610229
## 9 RIVER FLOOD 10.148404
## 10 ICE STORM 8.967041
g<- ggplot(health, aes(Event_Type, Number_of_Injuries)) +
labs(title="Total Fatalities & Injuries") +
xlab("") + ylab("Number of injuries")
plot1<- g + geom_bar(colour="red", stat="identity") + theme(axis.text.x = element_text(angle = 90, hjust = 1))
g<- ggplot(storm_PDMG, aes(Event_Type, Economic_Impact)) +
labs(title="Total Properties & Crop Damages") +
xlab("") + ylab("U$ Billions")
plot2<- g + geom_bar(colour="red", stat="identity") + theme(axis.text.x = element_text(angle = 90, hjust = 1))
print(plot1)
print(plot2)
Tornadoes are the major weather event in US, impacting fatalities and injuries which sum 96.979 cases in these period of analisys, followed by Excessive Heat with 8.428 cases. Related to the Properties and Crops damages it is possible to see that Floods have the major economic impact U$ 150.3 Billions followed by Hurricanes/Typhoons with the expressive value of U$ 71.9 billions.
Revision April/21/2015