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.
At first the data is loaded into R and a copy of the dataset is created to keep the original dataset clear:
if(!file.exists("repdata%2Fdata%2FStormData.csv.bz2")){
file.create("repdata%2Fdata%2FStormData.csv.bz2")
download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2")
}
stormdata <- read.csv("repdata%2Fdata%2FStormData.csv.bz2", header=T)
datastorm <- stormdata
Looking for damage in Property+Crop expressed in hundreds, thousand, millions or billions of Dollar and convert it into character format:
datastorm$PROPDMGEXP <- ifelse(datastorm$PROPDMGEXP %in% c("B", "h", "H", "K", "m", "M"), as.character(datastorm$PROPDMGEXP), "NONE")
datastorm$CROPDMGEXP <- ifelse(datastorm$CROPDMGEXP %in% c("B", "k", "K", "m", "M"), as.character(datastorm$CROPDMGEXP), "NONE")
datastorm$PROPandCROP <- datastorm$PROPDMG + datastorm$CROPDMG
economydamage <- datastorm$PROPandCROP
Here must be defined how many zeros need to be added to match with the expressions (for example, “m”/“M” = 10^6). We sum the damage values from property to crop in a new variable:
datastorm$PROPDMG <- datastorm$PROPDMG * (10^9 * (datastorm$PROPDMGEXP == "B") + 10^6 *(datastorm$PROPDMGEXP %in% c("m", "M")) + 10^3 * (datastorm$PROPDMGEXP %in% c("k", "K")) + 100 * (datastorm$PROPDMGEXP %in% c("h", "H")))
datastorm$CROPDMG <- datastorm$CROPDMG * (10^9 * (datastorm$CROPDMGEXP == "B") + 10^6 *(datastorm$CROPDMGEXP %in% c("m", "M")) + 10^3 * (datastorm$CROPDMGEXP %in% c("k", "K")) + 100 * (datastorm$CROPDMGEXP %in% c("h", "H")))
datastorm$PROPandCROP <- datastorm$PROPDMG + datastorm$CROPDMG
In this part we only need to sum the values for fatalities and injuries to make a statement about the impact on human health.
total_fatalities <- by(datastorm$FATALITIES, datastorm$EVTYPE, sum)
total_injuries <- by(datastorm$INJURIES, datastorm$EVTYPE, sum)
humanhealth <- datastorm$FATALITIES+datastorm$INJURIES
par(mfrow=c(1, 3))
barplot(sort(by(humanhealth, datastorm$EVTYPE, sum), decreasing=T)[20:1], horiz=T, las=1, cex.names=0.7, main = "Total Number of Health Issues per Event Type", col = "darkcyan")
barplot(sort(by(humanhealth, datastorm$EVTYPE, mean), decreasing=T)[20:1], horiz=T, las=1, cex.names=0.7, main ="Mean Number of Health Issues per Event Type", col = "darkcyan")
barplot(sort(by(economydamage, datastorm$EVTYPE, sum), decreasing=T)[20:1], horiz=T, las=1, cex.names=0.7, main ="Total Cost of Damage by Event Type", col = "darkcyan")
As we can see, tornados are most harmfull to public health as we are looking on absolute numbers. Looking at the mean values we see that heat waves have a bigger impact. Probably due to a larger spatial extent there are more vulnerable people like older people and children affected. Surprisingly tornados are also ranked 1 in economic damage, even before flash flood and wind.
_