Extreme weather events can pose significnat public health and economic problems for areas that are affected in the US. Property damage, loss of life, break down of social order are all possible consequenes of such events. Due to thier devasating effects, it is of upmost importance to study how to prevent such events.
This project uses the data from U.S. National Oceanic and Atmospheric Administration’s (NOAA), and tries to explore the major characteristics of major extreme weather events in the US. Estimates of fatalities, economic damgae are analyzed.
Obtaining data from this link
Uploading dat afrom local machine
setwd("~/R/Research")
stormdata<- read.csv("~/R/Research/data.bz2")
storm<- stormdata[c("EVTYPE", "FATALITIES", "INJURIES", "PROPDMG", "PROPDMGEXP", "CROPDMG", "CROPDMGEXP")]
str(storm)
## 'data.frame': 902297 obs. of 7 variables:
## $ EVTYPE : chr "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
## $ FATALITIES: num 0 0 0 0 0 0 0 0 1 0 ...
## $ INJURIES : num 15 0 2 2 2 6 1 0 14 0 ...
## $ PROPDMG : num 25 2.5 25 2.5 2.5 2.5 2.5 2.5 25 25 ...
## $ PROPDMGEXP: chr "K" "K" "K" "K" ...
## $ CROPDMG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ CROPDMGEXP: chr "" "" "" "" ...
head(storm)
## EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## 1 TORNADO 0 15 25.0 K 0
## 2 TORNADO 0 0 2.5 K 0
## 3 TORNADO 0 2 25.0 K 0
## 4 TORNADO 0 2 2.5 K 0
## 5 TORNADO 0 2 2.5 K 0
## 6 TORNADO 0 6 2.5 K 0
tail(storm)
## EVTYPE FATALITIES INJURIES PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## 902292 WINTER WEATHER 0 0 0 K 0 K
## 902293 HIGH WIND 0 0 0 K 0 K
## 902294 HIGH WIND 0 0 0 K 0 K
## 902295 HIGH WIND 0 0 0 K 0 K
## 902296 BLIZZARD 0 0 0 K 0 K
## 902297 HEAVY SNOW 0 0 0 K 0 K
library(plyr)
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
storm$PROPDMGEXP<- mapvalues(storm$PROPDMGEXP, from = c("K", "M","", "B", "m", "+", "0", "5", "6", "?", "4", "2", "3", "h", "7", "H", "-", "1", "8"), to = c(10^3, 10^6, 1, 10^9, 10^6, 0,1,10^5, 10^6, 0, 10^4, 10^2, 10^3, 10^2, 10^7, 10^2, 0, 10, 10^8))
storm$PROPDMGEXP<- as.numeric(as.character(storm$PROPDMGEXP))
storm$PROPDMGTOTAL<- (storm$PROPDMG * storm$PROPDMGEXP)/1000000000
storm$CROPDMGEXP<- mapvalues(storm$CROPDMGEXP, from = c("","M", "K", "m", "B", "?", "0", "k","2"), to = c(1,10^6, 10^3, 10^6, 10^9, 0, 1, 10^3, 10^2))
storm$CROPDMGEXP<- as.numeric(as.character(storm$CROPDMGEXP))
storm$CROPDMGTOTAL<- (storm$CROPDMG * storm$CROPDMGEXP)/1000000000
storm$DAMAGETOTAL<- storm$PROPDMGTOTAL + storm$CROPDMGEXP
detach(package:plyr)
storm_type<- storm %>%
mutate(evtypegrp = ifelse(grepl("LIGHTNING|LIGNTNING", EVTYPE), "LIGHTNING", ifelse(grepl("HAIL", EVTYPE), "HAIL", ifelse(grepl("RAIN|FLOOD|WET|FLD", EVTYPE), "RAIN", ifelse(grepl("SNOW|WINTER|WINTRY|BLIZZARD|SLEET|COLD|ICE|FREEZE|AVALANCHE|ICY", EVTYPE), "WINTER",
ifelse(grepl("TORNADO|FUNNEL", EVTYPE), "TORNADO",
ifelse(grepl("WIND|HURRICANE", EVTYPE), "WINDS",
ifelse(grepl("STORM|THUNDER|TSTM|TROPICAL +STORM", EVTYPE), "STORM",
ifelse(grepl("FIRE", EVTYPE), "FIRE",
ifelse(grepl("FOG|VISIBILITY|DARK|DUST", EVTYPE), "FOG",
ifelse(grepl("WAVE|SURF|SURGE|TIDE|TSUNAMI|CURRENT|SWELL", EVTYPE), "WAVE",
ifelse(grepl("HEAT|HIGH +TEMP|RECORD +TEMP|WARM|DRY", EVTYPE), "HEAT",
ifelse(grepl("VOLCAN", EVTYPE), "VOLCANO",
ifelse(grepl("DROUGHT", EVTYPE), "DROUGHT","OTHER"))))))))))))))
event_sum<- storm_type %>% group_by(evtypegrp) %>% summarise(damage = sum(DAMAGETOTAL), property= sum(PROPDMGTOTAL), crops = sum(CROPDMGTOTAL), fatallities = sum(FATALITIES), injuries = sum(INJURIES))
Totoal number of fatalities by event type
fatallities<-head(event_sum[order(event_sum$fatallities, decreasing=TRUE),],5)
ggplot(fatallities, aes(evtypegrp,fatallities, fill=fatallities)) + geom_bar(stat = "identity") + labs(x= "Event Type", y = "No. of Fatallities") +
ggtitle("Total no of Fatalities By Event Type")+
theme_update() +
expand_limits(y=c(0,8000))
Total number of injuires by event type
injuries<- head(event_sum[order(event_sum$injuries, decreasing = TRUE),], 5)
ggplot(injuries, aes(evtypegrp, injuries, fill=injuries)) + geom_bar(stat = "identity") + labs(x = "Event Type", y = "No of Injuries") + ggtitle("Total no of Injuries by Event Type")+ theme_gray(base_size = 11, base_family = "") + expand_limits(y=c(0, 8000))
Economic consequences
damage <-head(event_sum[order(event_sum$damage, decreasing=TRUE),],5)
property <- damage %>% mutate(damage_type="Property", damage_amount=property)
crops <- damage %>% mutate(damage_type="Crops", damage_amount=crops)
damage_major <- rbind(property,crops)
ggplot(damage_major, aes(evtypegrp, damage_amount, fill=factor(damage_type))) +
geom_bar(stat = "identity") +
ylab("Economical damage since 1950 to 2011") +
xlab("Event Type") +
scale_fill_discrete(name = "Damage") +
ggtitle ("Total Economical Damage caused by Event") +
theme_gray(base_size = 10, base_family = "")