This report analyzes the “storm database” of the U.S. National Oceanic and Atmospheric Administration (NOAA). It aims at finding the most dangerous events/storms indicated by harmfulness for population health and economic damage.
For this purpose the INJURIES and the PROPDMG data of the database are examined. Tornados are found to be by far the most dangerous weather events, both in terms of injuries to the population (as well as fatalities in the population) and economic consequences.
The first step of the processing is to load the tidyverse package (for easier data manipulation) and to read the csv file into the working environment (the compressed csv.bz2 file can directly be read using read.csv()). It is saved in the object storm_data.
The data set is already quite clean. We can use it as it is.
library("tidyverse")
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
storm_data <- read.csv("repdata_data_StormData.csv.bz2")
The columns we are interested in first are EVTYPE (“eventtype”), FATALITIES and INJURIES. To begin with, the data is grouped by EVTYPE and then fatalities and injuries are summed up by group. To get the most dangerous events, the summarised data is arranged decreasing by injuries and fatalities. Further, the column EVTYPE is transformed into a factor and the factor levels are sorted by amount of INJURIES to order the bars in the bar plot in the chapter results.
event_fatalities_injuries <- storm_data %>%
group_by(EVTYPE) %>%
summarise(INJURIES = sum(INJURIES),
FATALITIES = sum(FATALITIES)) %>%
arrange(-INJURIES)
event_fatalities_injuries <- event_fatalities_injuries %>%
mutate(EVTYPE = factor(EVTYPE,
levels = event_fatalities_injuries$EVTYPE[
order(event_fatalities_injuries$INJURIES,
decreasing = TRUE)]))
For the second question, the data is again grouped by the event type (EVTYPE) but this time the column PROPDMG (“property damage”) is summed up. Then the resulting data frame is arranged by PROPDMG (decreasing). Again, the column EVTYPE is transformed into a factor and the factor levels are sorted by amount of PROPDMG to order the bars in the bar plot in the chapter results.
event_prop_dmg <- storm_data %>%
group_by(EVTYPE) %>%
summarise(PROPDMG = sum(PROPDMG)) %>%
arrange(-PROPDMG)
event_prop_dmg <- event_prop_dmg %>%
mutate(EVTYPE = factor(EVTYPE,
levels = event_prop_dmg$EVTYPE[
order(event_prop_dmg$PROPDMG,
decreasing = TRUE)]))
The 10 events causing the most injuries are the following:
head(event_fatalities_injuries, 10)
## # A tibble: 10 × 3
## EVTYPE INJURIES FATALITIES
## <fct> <dbl> <dbl>
## 1 TORNADO 91346 5633
## 2 TSTM WIND 6957 504
## 3 FLOOD 6789 470
## 4 EXCESSIVE HEAT 6525 1903
## 5 LIGHTNING 5230 816
## 6 HEAT 2100 937
## 7 ICE STORM 1975 89
## 8 FLASH FLOOD 1777 978
## 9 THUNDERSTORM WIND 1488 133
## 10 HAIL 1361 15
To get a better intuition of the data it is plotted in a bar plot:
ggplot(event_fatalities_injuries %>% head(10), aes(x = EVTYPE, y = INJURIES)) +
geom_bar(stat = "identity") +
labs(
x = "event",
y = "injuries",
title = "10 most dangerous weather events in the US"
) +
theme(axis.text.x = element_text(angle = 30, hjust = 0.5, vjust = 0.5))
The weather event with the most injuries is “tornado” by far. More
injuries are caused by tornados (9.1346^{4}) than by the 9 next most
danerous weather events/storms (3.4202^{4}).
The 10 events causing the most property damage are:
head(event_prop_dmg, 10)
## # A tibble: 10 × 2
## EVTYPE PROPDMG
## <fct> <dbl>
## 1 TORNADO 3212258.
## 2 FLASH FLOOD 1420125.
## 3 TSTM WIND 1335966.
## 4 FLOOD 899938.
## 5 THUNDERSTORM WIND 876844.
## 6 HAIL 688693.
## 7 LIGHTNING 603352.
## 8 THUNDERSTORM WINDS 446293.
## 9 HIGH WIND 324732.
## 10 WINTER STORM 132721.
ggplot(event_prop_dmg %>% head(10), aes(x = EVTYPE, y = PROPDMG)) +
geom_bar(stat = "identity") +
labs(
x = "event",
y = "property damage ($)",
title = "10 most disastrous weather events in the US"
) +
theme(axis.text.x = element_text(angle = 30, hjust = 0.5, vjust = 0.5))
Tornados are the biggest threat when looking at the economic conequences of weather events in the US. “Flash flood” and “TSTM wind” are the next worse events with about 1/3 of the damage caused by tornados.