Natural calamities such as storms,flood, hurricanes etc.. can wreak havoc on people and the state. There is loss to human life and an economic impact everytime a natural calamity strikes. This project explores the US National Oceanic and Atmospheric Administration’s storm database. The database contains data on the past natural calamities and their impact on people and economy within the United States
This report analyses the major events that have impacted people and the economy. This lists the top events that have occured over the past few years.
options(warn=-1)
library(tidyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
The data is split into two parts. The first part analyses the health impact of the natural calamities. This includes fatalities and injuries to people.
The first part which analyses the health impact eventype, fatalities, and injuries. The fatalities and injuries are combined into one column using tidyr and dplyr packages. The total loss due to health is addition of both fatalities and injuries and is grouped by the calamity.
storm<-read.csv("repdata-data-StormData.csv",stringsAsFactors = TRUE)
colnames(storm)<-tolower(colnames(storm))
storm_health<-storm%>%select(evtype,fatalities,injuries)%>%gather(health,total,-evtype)%>%group_by(evtype)%>%summarize(total=sum(total))%>%arrange(desc(total))
top_ev<-storm_health%>%top_n(10)
## Selecting by total
ggplot(top_ev)+aes(x=reorder(evtype,-total),y=total)+geom_bar(stat="identity",fill="blue")+coord_flip()+labs(y="Total Damage in Dolars",x="Natutal Calamity")+ggtitle("Impact of natural calamities on people")
The analysis for econimic impact combines two variables, crop damage and property damage. The total damage is the summation of both these variables. The data set is filtered only to take damages that are more than 1000.
storm_eco<-storm%>%select(evtype,propdmg,propdmgexp,cropdmg,cropdmgexp)%>%gather(dmgtype,amount,-evtype,-propdmgexp,-cropdmgexp)%>%gather(dmgexptype,dmgexp,-evtype,-dmgtype,-amount)
storm_eco$dmgexp<-tolower(storm_eco$dmgexp)
storm_eco<-storm_eco%>%filter(dmgexp %in% c("k","m","b","5","6","7","8"))%>%
mutate(dmgmulti=ifelse (dmgexp=="k",1000,ifelse(dmgexp=="5",100000,ifelse(dmgexp=="m"|dmgexp=="6",1000000,
ifelse(dmgexp=="7",10000000,ifelse(dmgexp=="8",100000000,ifelse(dmgexp=="b",1000000000,0)))))))
storm_eco<-storm_eco%>%mutate(total=amount*dmgmulti)%>%group_by(evtype)%>%summarize(total=sum(total))%>%arrange(desc(total))
top_eco<-storm_eco%>%filter(evtype!="HURRICANE/TYPHOON")%>%top_n(10)
## Selecting by total
ggplot(top_eco)+aes(x=reorder(evtype,-total),y=total)+geom_bar(stat="identity",fill="blue")+coord_flip()+labs(y="Total Damage in Dolars",x="Natutal Calamity")+ggtitle("Impact of natural calamities on economy")
The analysis of impact of natural calamities on both people and the economy indicate that the mojor dirptive force is Hurricane and Tornado. Tornado and floods seem to cause great distress to people’s lives while hurricane damages a lot of peoperty and crops.