Weather conditions like flash floods, tornadoes, droughts have adverse effects on us human beings both socially and economically. This analysis uses data from the NOAA Storm Database which contains information about certain weather events from 1950-2011.
From the analysis it is clear that the most harm to population health (parameterised by the nu,ber of fatalities and injuries) was caused by Tornadoes which was way ahead of the other conditions like floods, excessive heat and lightening both in terms of the number of injuries and fatalities. From an economic perspective, floods have caused the maximum amount of damage to property (of about 145 Billion Dollars) over the years followed by Hurricanes and Tornadoes. However, droughts where the primary reasons for crop destruction followed by Floods, Ice Storms and Hail.
##uncomment the following "download.file" line if the data is not already present in the working directory with the filename "storm.csv.bz2"
## download.file(url = "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2","storm.csv.bz2")
storm <- read.csv("storm.csv.bz2")
storm_1 <- storm[storm$PROPDMGEXP %in% c("M","K","B"),]
storm_2 <- storm[storm$CROPDMGEXP %in% c("M","K","B"),]
storm_1$PROPDMGEXP <- sub("K",1000,storm_1$PROPDMGEXP)
storm_1$PROPDMGEXP <- sub("M",1000000,storm_1$PROPDMGEXP)
storm_1$PROPDMGEXP <- sub("B",1000000000,storm_1$PROPDMGEXP)
storm_1$PROPDMG <- as.numeric(storm_1$PROPDMGEXP)*storm_1$PROPDMG
storm_2$CROPDMGEXP <- sub("K",1000,storm_2$CROPDMGEXP)
storm_2$CROPDMGEXP <- sub("M",1000000,storm_2$CROPDMGEXP)
storm_2$CROPDMGEXP <- sub("B",1000000000,storm_2$CROPDMGEXP)
storm_2$CROPDMG <- as.numeric(storm_2$CROPDMGEXP)*storm_2$CROPDMG
##continue with this after injuries and death
The following graph shows the event types that caused the most harm to public health
par(mfrow=c(1,2))
barplot(sort(tapply(storm$INJURIES,storm$EVTYPE,sum,na.rm=T),decreasing = TRUE)[1:5],main = "Chief Reasons for Injuries",col = c("Red","Green","Blue","Yellow","Orange"),legend.text = T,cex.names = 0.6,ylab="Number of Injuries Caused (1950-2011)")
barplot(sort(tapply(storm$FATALITIES,storm$EVTYPE,sum,na.rm=T),decreasing = TRUE)[1:5],main = "Chief Reasons for Fatalities",col = c("Red","Green","Blue","Yellow","Orange"),legend.text = T,cex.names = 0.6,ylab="Number of Fatalities Caused (1950-2011)")
The Following graph shows the chief contributors to economic damage
par(mfrow=c(1,2))
barplot(sort(tapply(storm_1$PROPDMG,storm_1$EVTYPE,sum,na.rm=T)/10^9,decreasing = TRUE)[1:5],main = "Chief Property Detroyers",col = c("Red","Green","Blue","Yellow","Orange"),legend.text = T,cex.names = 0.6,ylab="Damage from 1950-2011 in Billions($)")
barplot(sort(tapply(storm_2$CROPDMG,storm_2$EVTYPE,sum,na.rm=T)/10^9,decreasing = TRUE)[1:5],main = "Chief Crop Destroyers",col = c("Red","Green","Blue","Yellow","Orange"),legend.text = T,cex.names = 0.6, ylab = "Damage from 1950-2011 in Billions($)")