This analysis uses the U.S National Oceanic and Atmospheric Administration’s (NOAA) Storm Events Database, with the details, locations, and fatalities files joined by event ID. To avoid double counting and overlapping data, the weather events were counted once per event ID, and fatalities once per fatality ID. Tornadoes caused the most deaths and injuries combined, while excessive heat was the most harmful per event. Thunderstorm winds occurred most often in the most states - Texas, Kansas, New York, Georgia, Pennsylvania, Illinois, Kentucky, Virginia, Missouri, North Carolina, Iowa, and Ohio. Events show distinct seasonality with Thunderstorm winds occurring most often during late spring - summer months, peaking during May. Among fatalities with a recorded sex, 57.3% were male, while 25.2% were female. Excessive heat caused the most deaths overall, affecting men more than women (69.3% male, 30.7% female). Tornadoes deaths were the shared most commonly between sexes (54% female, 46% male). The sexes differed most significantly among water-related event deaths: males made up 80% of deaths resulting from either rip currents or floods. One limitation to this data is that 17.5% of sex data is unknown.
I created the function comma() to turn numbers into text with comma separators. It is used in the plots so that axis and legend labels show readable counts.
library(tidyverse)
library(dplyr)
library(readr)
# format numbers with separators, ignore NAs
comma <- function(x) format(x, big.mark = ",", scientific = FALSE, trim = TRUE)
These lines build the full file paths to the three raw NOAA files (details, fatalities, locations). ‘folder_path’ is the folder that holds the files.
## Linking three raw files
folder_path <- "."
details_file <- file.path(folder_path, "StormEvents_details-ftp_v1.0_d2024_c20261119.csv.gz")
fatalities_file <- file.path(folder_path, "StormEvents_fatalities-ftp_v1.0_d2024_c20261119.csv.gz")
locations_file <- file.path(folder_path, "StormEvents_locations-ftp_v1.0_d2024_c20261119.csv.gz")
Each raw .csv.gz file is read into R as a data frame using the path built earlier.
The left_join() function keeps every row of the left table (details) and attaches matching rows from the right table by “EVENT_ID”.
‘relationship = “many-to-many”’ allows for one event to match several rows in both tables.
The final line builds a path for the output file, “StormEvents_joined_data.csv”, and saves the joined table as a new CSV using the write_csv() function.
details <- read.csv(details_file)
fatalities <- read.csv(fatalities_file)
locations <- read.csv(locations_file)
joined_data <- details %>%
left_join(locations, by = "EVENT_ID") %>%
left_join(fatalities, by = "EVENT_ID", relationship = "many-to-many")
output_file <- file.path(folder_path, "StormEvents_joined_data.csv")
write_csv(joined_data, output_file)
## Loading the joined data
The joined CSV is read back in as ‘storm_raw’, the starting point for all analysis. The last line prints a check of the total row count and the number of unique events.
storm_raw <- read_csv("StormEvents_joined_data.csv", guess_max = 100000)
cat("Rows:", nrow(storm_raw), "Unique events:", n_distinct(storm_raw$EVENT_ID), "\n")
## Rows: 85745 Unique events: 69802
The next two chunks split ‘storm_raw’ into two tables with different units: ‘storm’ (one row per event, used for Questions 1-3) and ‘fatal’ (one row per fatality, used for Question 4).
This chunk stores the main storm analysis into table, storm, which has exactly one row per event, and then checks it for missing values.
‘distinct(EVENT_ID)’ keeps one row per event, removing repeated rows.
coalesce(x, 0) replaces NA values with 0, which is crucial for calculating totals.
Direct and indirect deaths are combined into ‘deaths’, same with ‘injuries’. ‘total_harm’ is deaths plus injuries which is used for Question 1.
‘MONTH_NAME’ is converted to an ordered factor so months sort in calendar order instead of alphabetically.
The final line counts the missing values in each column. Zeroes mean there are no gaps.
storm <- storm_raw %>%
distinct(EVENT_ID, .keep_all = TRUE) %>%
mutate(
deaths = coalesce(DEATHS_DIRECT, 0) + coalesce (DEATHS_INDIRECT, 0),
injuries = coalesce(INJURIES_DIRECT, 0) + coalesce(INJURIES_INDIRECT, 0),
total_harm = deaths + injuries,
MONTH_NAME = factor(MONTH_NAME, levels = month.name)
)
# Missing values in key variables
storm %>% summarise(across(c(EVENT_TYPE, STATE, MONTH_NAME, deaths, injuries),
~ sum(is.na(.))))
## # A tibble: 1 × 5
## EVENT_TYPE STATE MONTH_NAME deaths injuries
## <int> <int> <int> <int> <int>
## 1 0 0 0 0 0
‘filter(!is.na(FATALITY_ID))’ drops rows with no fatality record.
‘distinct(FATALITY_ID)’ keeps one row per person, removing repeat rows.
‘“M”’ and ‘“F”’ are recoded as ‘“Male”’ and ‘“Female”’, blank or missing values become ‘“Unknown”’. This will be used for Question 4.
fatal <- storm_raw %>%
filter(!is.na(FATALITY_ID)) %>%
distinct(FATALITY_ID, .keep_all = TRUE) %>%
mutate(
sex = case_when(FATALITY_SEX == "M" ~ "Male",
FATALITY_SEX == "F" ~ "Female",
TRUE ~ "Unknown")
)
cat("Fatality records:", nrow(fatal), "\n")
## Fatality records: 1142
The table groups the event table by event type and sums deaths and injuries. ‘event_harm’ is total harm divided by the number of events of that type, showing how harmful a typical event is rather than the overall total.
health <- storm %>%
group_by(EVENT_TYPE) %>%
summarise(events = n(),
deaths = sum(deaths),
injuries = sum(injuries),
total_harm = deaths + injuries,
event_harm = total_harm / events,
.groups = "drop") %>%
arrange(desc(total_harm))
head(health, 10)
## # A tibble: 10 × 6
## EVENT_TYPE events deaths injuries total_harm event_harm
## <chr> <int> <dbl> <dbl> <dbl> <dbl>
## 1 Tornado 2138 53 658 711 0.333
## 2 Heat 3171 219 173 392 0.124
## 3 Excessive Heat 2660 253 100 353 0.133
## 4 Thunderstorm Wind 19940 53 161 214 0.0107
## 5 Flash Flood 4661 118 19 137 0.0294
## 6 Winter Weather 3557 25 87 112 0.0315
## 7 Rip Current 73 65 42 107 1.47
## 8 Hurricane (Typhoon) 76 17 85 102 1.34
## 9 Tropical Storm 544 78 12 90 0.165
## 10 Dense Fog 839 18 65 83 0.0989
health %>%
slice_max(total_harm, n = 10) %>%
pivot_longer(c(deaths, injuries), names_to = "type", values_to = "count") %>%
ggplot(aes(x = reorder(EVENT_TYPE, total_harm), y = count, fill = type)) +
geom_col() +
coord_flip() +
scale_y_continuous(labels = comma) +
labs(title = "Top 10 event types by deaths and injuries",
x = NULL, y = "People affected", fill = NULL)
Figure 1: Top 10 event types by total deaths and injuries.
The red bars show the number of deaths and the blue bars show injuries. Tornadoes caused the most total harm of all event types. Excessive heat and heat were the two leading causes of death.
The table counts events by state and event type, then keeps the most frequent event type in each state.
state_event <- storm %>% count(STATE, EVENT_TYPE, name = "n")
top_event_by_state <- state_event %>%
group_by(STATE) %>%
slice_max(n, n = 1, with_ties = FALSE) %>%
arrange(desc(n))
top_event_by_state
## # A tibble: 68 × 3
## # Groups: STATE [68]
## STATE EVENT_TYPE n
## <chr> <chr> <int>
## 1 TEXAS Hail 1588
## 2 KANSAS Thunderstorm Wind 1043
## 3 NEW YORK Thunderstorm Wind 1021
## 4 GEORGIA Thunderstorm Wind 1002
## 5 PENNSYLVANIA Thunderstorm Wind 971
## 6 ILLINOIS Thunderstorm Wind 959
## 7 OKLAHOMA Heat 912
## 8 KENTUCKY Thunderstorm Wind 818
## 9 VIRGINIA Thunderstorm Wind 732
## 10 GULF OF MEXICO Marine Thunderstorm Wind 728
## # ℹ 58 more rows
The heat map shows the 10 most common event types in the 15 states with the most evetns. Darker tiles mean more events.
top_type_of_events <- storm %>% count(EVENT_TYPE, sort = TRUE) %>% slice_head(n = 10) %>% pull(EVENT_TYPE)
top_states <- storm %>% count(STATE, sort = TRUE) %>% slice_head(n = 15) %>% pull(STATE)
state_event %>%
filter(EVENT_TYPE %in% top_type_of_events, STATE %in% top_states) %>%
ggplot(aes(x = EVENT_TYPE, y = STATE, fill = n)) +
geom_tile(color = "white", linewidth = 0.5) +
scale_fill_viridis_c(option = "plasma",
trans = "log10",
labels = comma,
n.breaks = 6,
direction = -1,
) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Event counts by state and type", x = NULL, fill = "Events")
Figure 2: Event counts for 10 most common event types in top states with most events.
According to the graph, Texas is the state with the most drought, flash flood, and hail related events. Oklahoma has the most heat related events. Kansas has the most Thunderstorm wind. California has the most high wind. Colorado has the most heavy snow. New York has the most winter weather related events.
The first table finds the month with the most events for every event type. ‘month_event’ holds monthly counts for the 10 most common event types, which is shown on the heat map.
# peak month for every event type
month_event <- storm %>%
filter(!is.na(MONTH_NAME), EVENT_TYPE %in% top_type_of_events) %>%
count(MONTH_NAME, EVENT_TYPE, name = "n")
storm %>%
count(EVENT_TYPE, MONTH_NAME) %>%
group_by(EVENT_TYPE) %>%
slice_max(n, n = 1, with_ties = FALSE) %>%
arrange(MONTH_NAME)
## # A tibble: 50 × 3
## # Groups: EVENT_TYPE [50]
## EVENT_TYPE MONTH_NAME n
## <chr> <fct> <int>
## 1 Astronomical Low Tide January 8
## 2 Avalanche January 9
## 3 Blizzard January 191
## 4 Coastal Flood January 124
## 5 Cold/Wind Chill January 719
## 6 Dense Fog January 239
## 7 Extreme Cold/Wind Chill January 700
## 8 Flood January 396
## 9 Freezing Fog January 3
## 10 Heavy Snow January 660
## # ℹ 40 more rows
ggplot(month_event, aes(x = MONTH_NAME, y = EVENT_TYPE, fill = n)) +
geom_tile(color = "white", linewidth = 0.5) +
scale_fill_viridis_c(trans = "log10",
labels = comma,
n.break = 6,
direction = -1,
option = "plasma") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(title = "Event types by month", x = NULL, y = NULL, fill = "Events")
Figure 3: Monthly counts for 10 most common event types.
Winter weather and heavy snow are most common during winter, especially January. High wind is also most common during the winter, but persists until May. Thunderstorm wind is most common during spring season, from May - August. Both heat and excessive heat are most common during the summer, from June to August. Hail is most common throughout spring and into late summer, with its peak occuring during May. Floods are most common during early winter and spring seasons, while flash floods peak during summer months, starting as early as May, peaking during August, and persisting until September. Drought is most likely to occur during late fall or early winter, with its peak in November.
The sex information is not entirely complete. ‘fatal_known’ keeps only records with a known sex for the comparisons that follow.
fatal %>%
count(sex) %>%
mutate(share = round(100 * n / sum(n), 1))
## # A tibble: 3 × 3
## sex n share
## <chr> <int> <dbl>
## 1 Female 288 25.2
## 2 Male 654 57.3
## 3 Unknown 200 17.5
fatal_known <- fatal %>% filter(sex != "Unknown")
Deaths by event type and sex
top_fatal_types <- fatal_known %>%
count(EVENT_TYPE, sort = TRUE) %>%
slice_head(n = 10) %>%
pull(EVENT_TYPE)
by_type <- fatal_known %>%
filter(EVENT_TYPE %in% top_fatal_types) %>%
count(EVENT_TYPE, sex)
ggplot(by_type, aes(x = reorder(EVENT_TYPE, n), y = n, fill = sex)) +
geom_col(position = "dodge") +
coord_flip() +
scale_y_continuous(labels = comma) +
labs(title = "Deaths by event type and sex",
x = NULL, y = "Deaths", fill = NULL)
Figure 4: Deaths by event type and sex.
The table gives the exact share of female and male deaths within each event type.
The red bars represent female fatalities, the blue bars represent male fatalities. Males make up the majority of fatalities resulting from weather events. Both excessive heat and heat are the leading causes of death for both males and females, but males disproportionately make up the data. Almost 18% of the records have no recorded sex.
by_type %>%
pivot_wider(names_from = sex, values_from = n, values_fill = 0) %>%
mutate(total = Male + Female,
pct_male = round(100 * Male / total, 1)) %>%
arrange(desc(total))
## # A tibble: 10 × 5
## EVENT_TYPE Female Male total pct_male
## <chr> <int> <int> <int> <dbl>
## 1 Excessive Heat 59 133 192 69.3
## 2 Heat 31 111 142 78.2
## 3 Flash Flood 47 66 113 58.4
## 4 Tropical Storm 21 51 72 70.8
## 5 Rip Current 7 57 64 89.1
## 6 Thunderstorm Wind 19 31 50 62
## 7 Tornado 27 23 50 46
## 8 Cold/Wind Chill 10 27 37 73
## 9 Flood 8 25 33 75.8
## 10 Winter Weather 12 12 24 50
where people died by sex
loc <- fatal_known %>%
filter(!is.na(FATALITY_LOCATION)) %>%
count(FATALITY_LOCATION, sex)
ggplot(loc, aes(x = reorder(FATALITY_LOCATION, n), y = n, fill = sex)) +
geom_col(position = "dodge") +
coord_flip() +
scale_y_continuous(labels = comma) +
labs(title = "Fatality location by sex", x = NULL, y = "Deaths", fill = NULL)
According to the data, male deaths occurred most commonly in outdoor
areas, permanent homes and mobile homes, and in water. Similarly, female
deaths most commonly occurred inside both permanent homes and mobile
homes, and outdoor areas, though males represent a disproportionate
amount of the data for each category.
The data cover only 2024 only, so patterns may differ in other years.
Percentages for locations with very few deaths should be read with caution: deaths may not have been reported in some regions.
Unknown data on sex accounts for 17.5% of the data on event type and sex fatality rates.