This report investigates the public health and economic impacts of severe weather events in the United States using the National Oceanic and Atmospheric Administration’s (NOAA) storm database. The data encompasses details on major storms, including their timing, location, and associated casualties and property damage.
Analysis revealed tornadoes as the most significant threat to public health, necessitating targeted investments in infrastructure improvements or early warning systems. While hurricanes and typhoons pose a major economic threat, the report highlights the need for increased funding towards preventative measures to safeguard property and crops.
library(ggplot2)
library(dplyr)
##
## 载入程辑包:'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(lubridate)
##
## 载入程辑包:'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
storm <- read.csv(bzfile("./repdata_data_StormData.csv.bz2"))
head(storm)
## STATE__ BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE EVTYPE
## 1 1 4/18/1950 0:00:00 0130 CST 97 MOBILE AL TORNADO
## 2 1 4/18/1950 0:00:00 0145 CST 3 BALDWIN AL TORNADO
## 3 1 2/20/1951 0:00:00 1600 CST 57 FAYETTE AL TORNADO
## 4 1 6/8/1951 0:00:00 0900 CST 89 MADISON AL TORNADO
## 5 1 11/15/1951 0:00:00 1500 CST 43 CULLMAN AL TORNADO
## 6 1 11/15/1951 0:00:00 2000 CST 77 LAUDERDALE AL TORNADO
## BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END COUNTYENDN
## 1 0 0 NA
## 2 0 0 NA
## 3 0 0 NA
## 4 0 0 NA
## 5 0 0 NA
## 6 0 0 NA
## END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES INJURIES PROPDMG
## 1 0 14.0 100 3 0 0 15 25.0
## 2 0 2.0 150 2 0 0 0 2.5
## 3 0 0.1 123 2 0 0 2 25.0
## 4 0 0.0 100 2 0 0 2 2.5
## 5 0 0.0 150 2 0 0 2 2.5
## 6 0 1.5 177 2 0 0 6 2.5
## PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES LATITUDE LONGITUDE
## 1 K 0 3040 8812
## 2 K 0 3042 8755
## 3 K 0 3340 8742
## 4 K 0 3458 8626
## 5 K 0 3412 8642
## 6 K 0 3450 8748
## LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1 3051 8806 1
## 2 0 0 2
## 3 0 0 3
## 4 0 0 4
## 5 0 0 5
## 6 0 0 6
Look at column names at the data.
names(storm)
## [1] "STATE__" "BGN_DATE" "BGN_TIME" "TIME_ZONE" "COUNTY"
## [6] "COUNTYNAME" "STATE" "EVTYPE" "BGN_RANGE" "BGN_AZI"
## [11] "BGN_LOCATI" "END_DATE" "END_TIME" "COUNTY_END" "COUNTYENDN"
## [16] "END_RANGE" "END_AZI" "END_LOCATI" "LENGTH" "WIDTH"
## [21] "F" "MAG" "FATALITIES" "INJURIES" "PROPDMG"
## [26] "PROPDMGEXP" "CROPDMG" "CROPDMGEXP" "WFO" "STATEOFFIC"
## [31] "ZONENAMES" "LATITUDE" "LONGITUDE" "LATITUDE_E" "LONGITUDE_"
## [36] "REMARKS" "REFNUM"
Subset the original data.
storm2 <- storm %>%
select(c("EVTYPE","FATALITIES","INJURIES","PROPDMG","PROPDMGEXP","CROPDMG","CROPDMGEXP")) %>%
rename_all(tolower)
str(storm2)
## '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 "" "" "" "" ...
Based on the information above, the data table now has 902,297 rows and 7 columns. Following is a brief description of each variable.
length(unique(storm$EVTYPE))
## [1] 985
pop_health <-
storm2 %>% select(evtype, fatalities, injuries) %>%
group_by(evtype) %>%
summarize(fatalities = sum(fatalities), injuries = sum(injuries), .groups='drop') %>%
arrange(desc(fatalities), desc(injuries)) %>%
slice(1:10) %>%
gather(key = type, value = value, fatalities, injuries)
unique(storm2$propdmgexp)
## [1] "K" "M" "" "B" "m" "+" "0" "5" "6" "?" "4" "2" "3" "h" "7" "H" "-" "1" "8"
unique(storm2$cropdmgexp)
## [1] "" "M" "K" "m" "B" "?" "0" "k" "2"
cost <- function(x) {
if (x == "H")
1E-4
else if (x == "K")
1E-3
else if (x == "M")
1
else if (x == "B")
1E3
else
1-6
}
economic <-
storm2 %>% select("evtype", "propdmg", "propdmgexp", "cropdmg", "cropdmgexp") %>%
mutate(prop_dmg = propdmg*sapply(propdmgexp, FUN = cost), crop_dmg = cropdmg*sapply(cropdmgexp, FUN = cost), .keep="unused") %>%
group_by(evtype) %>%
summarize(property = sum(prop_dmg), crop = sum(crop_dmg), .groups='drop') %>%
arrange(desc(property), desc(crop)) %>%
slice(1:10) %>%
gather(key = type, value = value, property, crop)
ggplot(data=pop_health, aes(reorder(evtype, -value), value, fill=type)) +
geom_bar(position = "dodge", stat="identity") +
labs(x="Event Type", y="Count") +
theme_bw() +
theme(axis.text.x = element_text(angle = 45, vjust=0.55)) +
ggtitle("Top 10 Storm Deaths & Injuries ") +
scale_fill_manual(values=c("red", "orange"))
Based on the bar plot, it’s evident that tornadoes have the highest
impact on the population health, since it causes the most fatalities and
injuries.
ggplot(data=economic, aes(reorder(evtype, -value), value, fill=type)) +
geom_bar(position = "dodge", stat="identity") +
labs(x="Event Type", y="Count (millions)") +
theme_bw() +
theme(axis.text.x = element_text(angle = 45, vjust=0.5)) +
ggtitle("Top 10 Storm Damage Costs") +
scale_fill_manual(values=c("green", "coral"))
From the bar plot, Floods and Hurricanes/Typhoons have highest property
and crop damage costs, thus resulting in the biggest economic
consequences.
Based on the analysis, resources should be directed towards dealing with tornadoes for the safety and health of population by building better infrastructure or early warning systems. As for dealing with hurricanes and typhoons, there should be more funding for innovation in developing better systems and infrastructure to safeguard these properties and crops to prevent damages as much as possible.