An Analysis Report of Health and Economic Impact by Severe Weather Events - Based on NOAA Storm Database Synopsis Storm and other severe weather events can cause both public health and economic problems for communities and municipalities. Many severs events can results in fatalities, injuries and property damage. Preventing such outcomes to the extent possible is a key concern. The U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database tracks characteristics of major storms and weather events in the United States, include when and where they occur, aswell as estimates of any fatalities, injuries and property damage. This report contains the exploratory analysis results on the health and economic impact by the severe weather events based on the data from NOAA database. Goal The basic goal of this assignment is to explore the NOAA Storm Database and answer some basic questions below and show the code for your entire analysis.Analysis can consist of table ,figures ,or other summaries. Questions Data analysis must address the following questions: 1. Across the United States,which types of events(as indicated in the EVTYPE variable)are most harmful with respect to population health? 2. across the United States, which type of events have the greastest economic consequences?
Data Analysis 1. Download “Storm Data” and read CSV File
setwd("~/R-Programming_DataScience_Coursera/Reproducible Research (course 5)/week4 , Peer assessment2 ")
storm <- read.csv("./repdata%2Fdata%2FStormData.csv.bz2",header= T)
head(storm)
## 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
storm$PROPDMGEXP <- as.character(storm$PROPDMGEXP)
storm$CROPDMGEXP <- as.character(storm$CROPDMGEXP)
# subset the data to health and ecomic impact analysis against weather
# event
mycol <- c("EVTYPE","FATALITIES","INJURIES","PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")
mydata <- storm[mycol]
Preparing the property damage data
# exploring the property exponet
unique(mydata$PROPDMGEXP)
## [1] "K" "M" "" "B" "m" "+" "0" "5" "6" "?" "4" "2" "3" "h" "7" "H" "-"
## [18] "1" "8"
[15] “7” “H” “-” “1” “8” ## Levels: - ? + 0 1 2 3 4 5 6 7 8 B h H K m M
# Sorting the property exponet data
mydata$PROPEXP[mydata$PROPDMGEXP== "K"] <- 1000
mydata$PROPEXP[mydata$PROPDMGEXP== "M"] <- 1e+06
mydata$PROPEXP[mydata$PROPDMGEXP == ""] <- 1
mydata$PROPEXP[mydata$PROPDMGEXP == "B"] <- 1e+09
mydata$PROPEXP[mydata$PROPDMGEXP == "m"] <- 1e+06
mydata$PROPEXP[mydata$PROPDMGEXP == "0"] <- 1
mydata$PROPEXP[mydata$PROPDMGEXP == "5"] <- 1e+05
mydata$PROPEXP[mydata$PROPDMGEXP == "6"] <- 1e+06
mydata$PROPEXP[mydata$PROPDMGEXP == "4"] <- 10000
mydata$PROPEXP[mydata$PROPDMGEXP == "2"] <- 100
mydata$PROPEXP[mydata$PROPDMGEXP == "3"] <- 1000
mydata$PROPEXP[mydata$PROPDMGEXP == "h"] <- 100
mydata$PROPEXP[mydata$PROPDMGEXP == "7"] <- 1e+07
mydata$PROPEXP[mydata$PROPDMGEXP == "H"] <- 100
mydata$PROPEXP[mydata$PROPDMGEXP == "1"] <- 10
mydata$PROPEXP[mydata$PROPDMGEXP == "8"] <- 1e+08
# give 0 to invalid exponet data, so they not count in
mydata$PROPEXP[mydata$PROPDMGEXP == "+"] <- 0
mydata$PROPEXP[mydata$PROPDMGEXP == "-"] <- 0
mydata$PROPEXP[mydata$PROPDMGEXP == "?"] <- 0
# compute the property damage value
mydata$PRODMGVAL <- mydata$PROPDMG * mydata$PROPEXP
Preparing the crop damage data
# exploring the crop exponet data
unique(mydata$CROPDMGEXP)
## [1] "" "M" "K" "m" "B" "?" "0" "k" "2"
# Sorting the property exponent data
mydata$CROPEXP[mydata$CROPDMGEXP == "m"] <- 1e+06
mydata$CROPEXP[mydata$CROPDMGEXP == "K"] <- 1000
mydata$CROPEXP[mydata$CROPDMGEXP == "B"] <- 1e+09
mydata$CROPEXP[mydata$CROPDMGEXP == "0"] <- 1
mydata$CROPEXP[mydata$CROPDMGEXP == "k"] <- 1000
mydata$CROPEXP[mydata$CROPDMGEXP == "2"] <- 100
mydata$CROPEXP[mydata$CROPDMGEXP == ""] <- 1
# give 0 to invalid exponet data, so they not count in
mydata$CROPEXP[mydata$CROPDMGEXP == "?"] <- 0
# compute the crop damage value
mydata$CROPDMGVAL <- mydata$CROPDMG * mydata$CROPEXP
Aggregate the data by event
fatal <- aggregate(FATALITIES~EVTYPE, data=mydata,FUN = sum)
injury <- aggregate(INJURIES~EVTYPE,data = mydata,FUN = sum)
propdmg <- aggregate(PRODMGVAL~ EVTYPE,data=mydata,FUN = sum)
cropdmg <- aggregate(CROPDMGVAL~EVTYPE,data = mydata,FUN = sum)
Results Across the United States,which types of events are most harmful with respect to population health?
# get top10 event with highest fatalities
fatalTop10 <- fatal[order(-fatal$FATALITIES),] [1:10,]
# get top 10 event with highest injuries
injuryTop10 <- injury[order(-injury$INJURIES),] [1:10,]
par(mfrow=c(1,2), mar=c(12,4,3,2),mgp=c(3,1,0),cex=0.8)
barplot(fatalTop10$FATALITIES, las=3,names.arg = fatalTop10$EVTYPE ,main= "Weather Events With The Top 10 Highest Fatalities", ylab = "number of fatalities", col = "red")
barplot(injuryTop10$INJURIES, las = 3, names.arg = injuryTop10$EVTYPE, main = "Weather Events With the Top 10 Highest Injuries", ylab = "number of injuries", col ="red")
Human Casualities: From the graph the most harmful weather event to population health is Tornado. It has caused the highest fatalities and the highest injuries across the United States. Across the United States, which types of events have the greatest economic consequences?
# get top 10 events with highest property damage
propdmg10 <- propdmg[order(-propdmg$PRODMGVAL),] [1:10,]
# get top 10 events with highest crop damage
cropdmg10 <- cropdmg[order(-cropdmg$CROPDMGVAL),][1:10,]
par(mfrow=c(1,2),mar=c(12,4,3,2),mgp=c(3,1,0),cex=0.8)
barplot(propdmg10$PRODMGVAL/(10^9), las = 3, names.arg = propdmg10 $EVTYPE, main = "Top 10 Events with Greatest Property Damages" , ylab = "Cost of damages ($ billions)", col = "red")
barplot(cropdmg10$CROPDMGVAL/(10^9), las = 3, names.arg = cropdmg10$EVTYPE, main = "Top 10 Events With Greatest Crop Damages", ylab = "Cost of damages ($ billions)", col = "red")
knitr::opts_chunk$set(echo = TRUE)