Synopsis

Storms and other severe weather events can cause both public health and economic problems for communities and municipalities.

This project involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm databas to answer the 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 types of events have the greatest economic consequences?

Loading 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.

df_noaa <- read.csv(bzfile("stormData.csv.bz2"), sep=",", header=T)
df_sub <- df_noaa[,c('EVTYPE','FATALITIES','INJURIES', 'PROPDMG', 'PROPDMGEXP', 'CROPDMG', 'CROPDMGEXP')]
str(df_sub)
## '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  "" "" "" "" ...

The following variables record economic damages of each major storms and weather events in the United States: PROPDMG and CROPDMG: Amount (without unit) of property damage and crop damage PROPDMGEXP and CROPDMGEXP: Unit expressed in power of 10 of the above variables (H,K,M B means Hundreds, Thousands, Millions and Billions respectively)

df_sub2 <- df_sub %>% select("EVTYPE", "FATALITIES", "INJURIES")
propdmg_num <- rep(0,nrow(df_sub))
cropdmg_num <- rep(0,nrow(df_sub))
df_sub2 <- cbind(df_sub2, propdmg_num)
df_sub2 <- cbind(df_sub2, cropdmg_num)

df_sub2[df_sub$PROPDMGEXP == "H", ]$propdmg_num = df_sub[df_sub$PROPDMGEXP == "H", ]$PROPDMG * 10^2
df_sub2[df_sub$PROPDMGEXP == "K", ]$propdmg_num = df_sub[df_sub$PROPDMGEXP == "K", ]$PROPDMG * 10^3
df_sub2[df_sub$PROPDMGEXP == "M", ]$propdmg_num = df_sub[df_sub$PROPDMGEXP == "M", ]$PROPDMG * 10^6
df_sub2[df_sub$PROPDMGEXP == "B", ]$propdmg_num = df_sub[df_sub$PROPDMGEXP == "B", ]$PROPDMG * 10^9

df_sub2[df_sub$CROPDMGEXP == "H", ]$cropdmg_num = df_sub[df_sub$CROPDMGEXP == "H", ]$CROPDMG * 10^2
df_sub2[df_sub$CROPDMGEXP == "K", ]$cropdmg_num = df_sub[df_sub$CROPDMGEXP == "K", ]$CROPDMG * 10^3
df_sub2[df_sub$CROPDMGEXP == "M", ]$cropdmg_num = df_sub[df_sub$CROPDMGEXP == "M", ]$CROPDMG * 10^6
df_sub2[df_sub$CROPDMGEXP == "B", ]$cropdmg_num = df_sub[df_sub$CROPDMGEXP == "B", ]$CROPDMG * 10^9

Types of Events Most Harmful with Respect to Population Health

fatalities <- df_sub2 %>% group_by(EVTYPE) %>% summarise(fatalities_num = sum(FATALITIES,na.rm = TRUE))
fatalities_top10 <- fatalities[order(fatalities$fatalities_num,decreasing = TRUE),][c(1:10),]
                                                                                
ggplot(fatalities_top10,aes(x = reorder(EVTYPE,-fatalities_num), y = fatalities_num)) +
        geom_bar(stat = "identity", fill = "blue") + 
        theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
        xlab("Event Type") + ylab("Fatalities") + ggtitle("Number of fatalities by top 10 Weather Events")

Finding: Tornadoes causes the most harm to public health. The figure show the top 10 events that cause of fatalities and injuries in the United States.

Types of Events That Hae the Greatest Economic Consequences

damages <- df_sub2 %>% group_by(EVTYPE) %>% summarise(damages_num = sum(propdmg_num + cropdmg_num,na.rm = TRUE))
damages_top10 <- damages[order(damages$damages_num,decreasing = TRUE),][c(1:10),]

ggplot(damages_top10,aes(x = reorder(EVTYPE,-damages_num), y = damages_num)) +
        geom_bar(stat = "identity", fill = "blue") + 
        theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
        xlab("Event Type") + ylab("Damages in dollars") + ggtitle("Amout of damages by top 10 Weather Events")