This report uses NOAA’s Storm Events Database to find which severe weather events harmed people and property most in the U.S. in 2024, and where and when they happened. Event counts come from the details file, which has one row for each of 69,802 events. Heat caused the most deaths and injuries combined (745), just ahead of tornadoes (711), but only because I combined Heat and Excessive Heat into one category. By deaths alone, heat (472) and flash floods (118) led, and most tornado deaths happened in mobile or trailer homes. Thunderstorm Wind was the most common event in 36 of the 50 states and DC, and the rest mostly recorded events that fit their climate, such as Hail in Texas. Winter events peaked in January, Hail and Thunderstorm Wind in May, Heat in July, and Flash Floods in August. Hurricanes caused the most property and crop damage, about $6.8 billion from only 76 events. The costliest event types were mostly not the most harmful to health. Damage totals include only events with a reported estimate, so true costs are likely higher.
The data come from the U.S. National Oceanic and Atmospheric
Administration (NOAA) Storm Events Database. This database tracks major
storms and weather events in the United States, including when and where
they happened and estimates of fatalities, injuries, and property
damage. I used three raw files for 2024 (file version
c20261119): the details file, the
fatalities file, and the locations
file. All three are linked by the EVENT_ID variable. The
code loads the compressed .csv.gz files without unzipping
them first, so no processing happened outside this document.
All code, the raw data files, a README, and a codebook are in the project’s GitHub repository: https://github.com/evans107-t/Final-Course-Project-Analysis-of-NOAA-Storm-Database
Code explanation:
message = FALSE hides the messages dplyr
prints when it loads, such as the list of functions it masks from other
packages. The code itself still appears in the report because
echo stays TRUE.library(dplyr) loads dplyr, a package for
working with data frames, such as joining, filtering, and summarizing
them.library(readr) loads readr, a package for
reading and writing files such as CSVs.library(ggplot2) loads ggplot2, a package
that builds plots in layers: the data, the aesthetic mappings
(aes()), the shapes drawn on screen
(geom_*()), and the theme.These are in their own chunk so they load every time the document is knit, even when the data chunk below is read from the cache.
library(dplyr)
library(readr)
library(ggplot2)
If the raw files are not already in the data folder,
this chunk downloads them from NOAA. The files are also included in the
repository, because NOAA replaces older file versions when it publishes
updates, and the download links may stop working.
Code explanation:
file.exists() checks whether the
data folder exists, and dir.create() creates
it if it is missing.noaa_url stores the address of NOAA’s bulk
CSV folder.c() stores the three file names in
file_names.for loop repeats the steps inside
{ } once for each file name.!file.exists() is TRUE when the file is not
already in the data folder, so the download only runs for
missing files.download.file() downloads the file
from its URL. paste(..., sep = "") joins the folder address
and the file name with no space between them, which gives the full link.
destfile sets where the file is saved.
mode = "wb" writes the file in binary mode, which
compressed .gz files need on Windows.if (!file.exists("data")) {
dir.create("data")
}
noaa_url <- "https://www.ncei.noaa.gov/pub/data/swdi/stormevents/csvfiles/"
file_names <- c("StormEvents_details-ftp_v1.0_d2024_c20261119.csv.gz",
"StormEvents_fatalities-ftp_v1.0_d2024_c20261119.csv.gz",
"StormEvents_locations-ftp_v1.0_d2024_c20261119.csv.gz")
for (f in file_names) {
if (!file.exists(paste("data/", f, sep = ""))) {
download.file(paste(noaa_url, f, sep = ""),
destfile = paste("data/", f, sep = ""), mode = "wb")
}
}
Code explanation:
read_csv() reads the raw details file, which
has one row per storm event. It can open .gz files without
unzipping them first. show_col_types = FALSE stops
read_csv() from printing a summary of every column’s
type.joined_data <- saves the result, and the
pipe %>% passes details to the next
step.left_join() merges details with
locations, using EVENT_ID as the common key.
It keeps all rows from details and brings in the matching
rows from locations.left_join() merges that result with
fatalities the same way. Events with no match still appear,
with NA in the new columns.
relationship = "many-to-many" tells
left_join() that I expect some events to have several rows
in both tables. Without it, dplyr prints a warning about the repeated
rows. The next section checks how much those repeated rows inflate the
totals.write_csv() saves the joined data as
StormEvents_joined_data.csv in the data
folder.The file paths start at the data folder inside the
project, not at a folder on one specific computer, so the analysis runs
on any machine that has the project folder. cache = TRUE
saves this chunk’s result after the first knit, so later knits skip
reloading the large details file.
details <- read_csv("data/StormEvents_details-ftp_v1.0_d2024_c20261119.csv.gz", show_col_types = FALSE)
fatalities <- read_csv("data/StormEvents_fatalities-ftp_v1.0_d2024_c20261119.csv.gz", show_col_types = FALSE)
locations <- read_csv("data/StormEvents_locations-ftp_v1.0_d2024_c20261119.csv.gz", show_col_types = FALSE)
joined_data <- details %>%
left_join(locations, by = "EVENT_ID") %>%
left_join(fatalities, by = "EVENT_ID", relationship = "many-to-many")
write_csv(joined_data, "data/StormEvents_joined_data.csv")
One event can have several location rows and several fatality rows.
Because the join matches on EVENT_ID, an event with both
gets one row for every pairing of a location row and a fatality row in
joined_data. Before analyzing anything, I compared the row
counts and the total direct deaths in the two tables.
Code explanation:
data.frame() creates a small
comparison table directly from named vectors, with one row for each data
set.dataset names the two data sets being
compared.nrow() returns the number of rows in each
data set.sum() adds up
DEATHS_DIRECT in each data set. na.rm = TRUE
tells sum() to ignore missing values.table() counts how many rows each
EVENT_ID has, and max() returns the largest
count. A result of 1 means no event ID repeats, so details
has exactly one row per event.data.frame(
dataset = c("details", "joined_data"),
rows = c(nrow(details), nrow(joined_data)),
direct_deaths = c(sum(details$DEATHS_DIRECT, na.rm = TRUE),
sum(joined_data$DEATHS_DIRECT, na.rm = TRUE))
)
## dataset rows direct_deaths
## 1 details 69802 774
## 2 joined_data 85745 4852
max(table(details$EVENT_ID))
## [1] 1
The details table has one row per event (69,802 rows for 69,802
events). The joined table has extra rows, and each event’s deaths are
counted once for every repeated row. As a result, its direct death total
is 4,852, more than six times the 774 in the details table. This is the
duplication that relationship = "many-to-many" acknowledges
in the join above. Every count of events, deaths, and injuries in
Questions 1 to 4 comes from the details table, and I used the joined
table only to show the duplication above. All four questions and Figures
1 to 4 use details or details_states. Figure 5
joins the fatalities file to the details table alone, which does not
repeat rows, as its section shows.
MONTH_NAME is stored as plain text, so R would sort it
alphabetically (April, August, December…). I converted it to a factor
with the months in calendar order so tables and plots list the months
from January through December.
Code explanation:
details <- saves the changes to
details. The pipe %>% passes
details to the next step.mutate() changes the existing
MONTH_NAME column. factor() converts it into a
factor, which is R’s type for categorical variables.levels argument sets the order
of the categories, so the twelve months follow calendar order.details <- details %>%
mutate(MONTH_NAME = factor(MONTH_NAME,
levels = c("January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December")))
NOAA records Heat and Excessive Heat as separate event types. Both describe periods of dangerous heat, so keeping them apart would split heat’s impact across two categories and make heat look less harmful than it is. In 2024, NOAA recorded 3,171 Heat events and 2,660 Excessive Heat events. I combined them into one “Heat” category with 5,831 events. This choice affects Question 1. Kept separate, each heat type has fewer deaths and injuries than tornadoes, but combined, heat ranks first. The code below prints the health total for each heat type before combining, so this claim can be checked.
NOAA’s list has other pairs of related event types, such as Flood and Flash Flood, and Hurricane (Typhoon) and Tropical Storm. I kept NOAA’s categories for those pairs. At the end of the Results section, I check whether combining them would change any of the main rankings.
Code explanation:
table() counts how many events of each type
there are, and [ ] with the two names keeps only the counts
for Heat and Excessive Heat.table() counts how many events of each type
there are, so the table has one entry per event type.
length() counts the entries, which gives the number of
event types before combining.heat_check <- saves the result as a new
table, and %>% passes details to the next
step. details itself stays unchanged.filter() with %in% keeps only
Heat, Excessive Heat, and Tornado events.group_by() groups the rows by
EVENT_TYPE.summarize() adds the four death and
injury columns within each group. This shows each heat type’s health
total on its own, next to tornadoes.heat_check. The paragraph below this
chunk and the Limitations section also pull these totals from it.details <- saves the changes to
details, and %>% passes
details to the next step.mutate() changes the existing
EVENT_TYPE column. ifelse() takes three
arguments: a logical test (EVENT_TYPE == "Excessive Heat"),
the value to use when the test is TRUE ("Heat"), and the
value to use when it is FALSE (the original
EVENT_TYPE).length(table()) counts the event types
again. It should be one fewer than before.table(details$EVENT_TYPE)[c("Heat", "Excessive Heat")]
##
## Heat Excessive Heat
## 3171 2660
length(table(details$EVENT_TYPE))
## [1] 50
heat_check <- details %>%
filter(EVENT_TYPE %in% c("Heat", "Excessive Heat", "Tornado")) %>%
group_by(EVENT_TYPE) %>%
summarize(health_total = sum(DEATHS_DIRECT + DEATHS_INDIRECT +
INJURIES_DIRECT + INJURIES_INDIRECT))
heat_check
## # A tibble: 3 × 2
## EVENT_TYPE health_total
## <chr> <dbl>
## 1 Excessive Heat 353
## 2 Heat 392
## 3 Tornado 711
details <- details %>%
mutate(EVENT_TYPE = ifelse(EVENT_TYPE == "Excessive Heat", "Heat", EVENT_TYPE))
length(table(details$EVENT_TYPE))
## [1] 49
Excessive Heat alone has 353 deaths and injuries, and Heat alone has 392. Both are below Tornado’s 711, but together they reach 745. Combining the two categories reduces the number of event types from 50 to 49.
To measure harm to population health, I added direct deaths, indirect deaths, direct injuries, and indirect injuries into one total for each event. NOAA counts a death or injury as direct when the event itself caused it and as indirect when the event caused it less directly. I included both because both are harm the event led to, and leaving out the indirect ones would understate the harm. This total counts a death and an injury the same way, even though a death is more serious. To keep that difference visible, the Question 1 table also shows deaths and injuries in separate columns.
Code explanation:
details <- saves the changes to
details, and %>% passes
details to the next step.mutate() creates a new variable,
HEALTH_TOTAL, by adding the four death and injury columns
row by row. This gives one total per event.sum(is.na()) counts the events where
HEALTH_TOTAL is NA. Adding anything to an
NA gives NA, so the result is 0 only if none
of the four death and injury columns has a missing value.details <- details %>%
mutate(HEALTH_TOTAL = DEATHS_DIRECT + DEATHS_INDIRECT +
INJURIES_DIRECT + INJURIES_INDIRECT)
sum(is.na(details$HEALTH_TOTAL))
## [1] 0
NOAA stores property and crop damage as text with a letter for the
unit, such as “10.00K” for $10,000, “1.50M” for $1.5 million, and
“1.00B” for $1 billion. R cannot add or compare these values while they
are text. sum() will not work on them, and sorting puts
them in alphabetical order, so “1.50M” would come before “10.00K” even
though it is 150 times larger. The number alone is also misleading
without its unit, since 1.50 million is far more than 10.00 thousand. I
converted every value to a full dollar amount so the totals can be added
and ranked correctly. Events with no damage estimate stay
NA instead of becoming 0, because a missing estimate does
not mean the event caused no damage. NOAA records events with no damage
as “0.00K”, so a reported zero and a missing estimate mean different
things. Leaving the missing ones as NA keeps them out of
the totals, so the damage totals in this report count only events with a
reported estimate. Before writing the conversion, I checked which unit
letters actually appear in the two columns.
Code explanation:
gsub() performs global substitution,
replacing all occurrences of a pattern within each value. The pattern
[0-9.] is a character class. The square brackets define a
set of acceptable characters, and the hyphen defines an inclusive range,
so [0-9.] matches any digit from 0 to 9 or a decimal point.
Replacing those with "" leaves only the unit letter, and
table() counts how often each letter appears. This shows
which units the function has to handle.sum(is.na()) counts how many NAs are in
DAMAGE_PROPERTY before conversion. is.na()
returns TRUE for each missing value, and sum() adds them
up, since TRUE counts as 1 and FALSE as 0.DAMAGE_CROPS.convert_damage is created using the
function() directive and stored as an R object. It has one
formal argument, x, which stands for the damage column
passed in. Writing the steps once as a function means the same
conversion runs on both damage columns without repeating the code.gsub() replaces the pattern
[KMB], a character class that matches any one of the
letters K, M, or B, with "", so the letter is removed. For
example, “1.50M” becomes “1.50”. as.numeric() then coerces
that text to the number 1.5, which the next lines multiply by the right
amount.grepl() returns a logical vector
(TRUE or FALSE) showing whether each value contains that letter. The
nested ifelse() picks the matching multiplier: 1,000 for K,
1,000,000 for M, and 1,000,000,000 for B.NA.} closes the function.mutate() uses
convert_damage() to create two new numeric variables,
PROPERTY_DMG and CROP_DMG.sum(is.na()) counts how many NAs are in
PROPERTY_DMG after conversion, which is the number of
events with no property damage estimate.CROP_DMG.table(gsub("[0-9.]", "", details$DAMAGE_PROPERTY))
##
## B K M
## 4 54232 520
table(gsub("[0-9.]", "", details$DAMAGE_CROPS))
##
## K M
## 54265 124
sum(is.na(details$DAMAGE_PROPERTY))
## [1] 15046
sum(is.na(details$DAMAGE_CROPS))
## [1] 15413
convert_damage <- function(x) {
number <- as.numeric(gsub("[KMB]", "", x))
multiplier <- ifelse(grepl("K", x), 1000,
ifelse(grepl("M", x), 1000000,
ifelse(grepl("B", x), 1000000000, 1)))
number * multiplier
}
details <- details %>%
mutate(PROPERTY_DMG = convert_damage(DAMAGE_PROPERTY),
CROP_DMG = convert_damage(DAMAGE_CROPS))
sum(is.na(details$PROPERTY_DMG))
## [1] 15046
sum(is.na(details$CROP_DMG))
## [1] 15413
The only unit letters are K, M, and B, so the function covers every reported value. The number of missing values after conversion (15,046 and 15,413) matches the number before, so the conversion did not create any new missing values.
The STATE column holds more than the 50 states and DC.
It also includes 4 U.S. territories (American Samoa, Guam, Puerto Rico,
and the Virgin Islands) and 13 bodies of water, such as the Gulf of
Mexico and the Great Lakes. NOAA records storms over water in these
marine zones, and most of the events there are marine types, such as
Marine Thunderstorm Wind. Question 2 compares states, so a lake, an
ocean zone, or a territory does not belong in that comparison. I made a
separate data set, details_states, that keeps only the 50
states and DC, which leaves 66,388 events. The code lists the places to
keep instead of the places to remove, so if a later version of the file
adds a new marine zone, it is still left out. The last line prints the
17 removed areas and how many events each had, so the list can be
checked. The full details table stays unchanged for
Questions 1, 3, and 4, because those questions look at event types
across the whole database, and harm and damage in territories and
coastal waters still count there. This is also why Marine Thunderstorm
Wind appears in Question 3 but never in Question 2.
Code explanation:
state.name is a character vector of the 50
state names that comes with R. toupper() converts them to
capital letters to match how NOAA writes STATE.
c() adds “DISTRICT OF COLUMBIA”, and the result is saved as
keep_states.details_states <- saves the result as a
new data set, so details itself stays unchanged.filter() with %in% keeps only
the rows whose STATE appears in
keep_states.nrow() counts the rows in
details_states, which is the number of events left for
Question 2.table() counts the events in each place left,
and length() counts the entries. It should be 51.details$STATE %in% keep_states is TRUE for
rows in the 50 states and DC, and ! flips TRUE and FALSE,
so it is TRUE for the removed areas. Putting that inside
[ ] keeps only those rows’ STATE values, and
table() counts the events in each one. This lists the 17
removed areas and how many events each had.keep_states <- c(toupper(state.name), "DISTRICT OF COLUMBIA")
details_states <- details %>%
filter(STATE %in% keep_states)
nrow(details_states)
## [1] 66388
length(table(details_states$STATE))
## [1] 51
table(details$STATE[!(details$STATE %in% keep_states)])
##
## AMERICAN SAMOA ATLANTIC NORTH ATLANTIC SOUTH E PACIFIC GUAM
## 23 673 582 5 57
## GUAM WATERS GULF OF ALASKA GULF OF MEXICO LAKE ERIE LAKE HURON
## 1 2 877 111 21
## LAKE MICHIGAN LAKE ONTARIO LAKE ST CLAIR LAKE SUPERIOR PUERTO RICO
## 154 29 31 72 746
## ST LAWRENCE R VIRGIN ISLANDS
## 3 27
To answer this question, I added up HEALTH_TOTAL (deaths
plus injuries) for each event type and ranked the types from most to
least harmful. I used the full details table, so harm in
territories and coastal waters counts too. The table also splits each
total into deaths and injuries, because two event types with similar
totals can affect people in very different ways. Table 1 and Figure 1
show the 10 most harmful event types. Table 2 ranks event types by
deaths alone, because someone focused on preventing deaths would rank
them differently.
Code explanation:
health_by_type <- saves the result, and
%>% passes details to the next step.group_by() groups the data by
EVENT_TYPE, so the next step calculates one result per
event type.summarize() generates summary
statistics, one row per event type. sum() adds up deaths
(direct plus indirect), injuries (direct plus indirect), and the total
health impact within each group.arrange() sorts the rows by
health_total, and wrapping it in desc() sorts
them from highest to lowest.as.data.frame() turns the result into a plain
data frame so the next line can give it row names.rownames() names each row after its event
type. This lets the Answer below pull a single number, such as
health_by_type["Heat", "deaths"], straight from the data
instead of retyping it.knitr::kable() prints the first 10
rows as a formatted table instead of raw console output.
knitr:: calls the function from the knitr package without
loading the whole package. row.names = FALSE hides the row
names, since the event type is already the first column.
col.names gives the columns readable headings, and
caption adds a title.arrange(desc(deaths)) sorts the
event types by deaths alone, head(..., 5) keeps the top 5,
and kable() prints them as a second table.health_by_type <- details %>%
group_by(EVENT_TYPE) %>%
summarize(deaths = sum(DEATHS_DIRECT + DEATHS_INDIRECT),
injuries = sum(INJURIES_DIRECT + INJURIES_INDIRECT),
health_total = sum(HEALTH_TOTAL)) %>%
arrange(desc(health_total)) %>%
as.data.frame()
rownames(health_by_type) <- health_by_type$EVENT_TYPE
knitr::kable(head(health_by_type, 10), row.names = FALSE,
col.names = c("Event type", "Deaths", "Injuries", "Deaths + injuries"),
caption = "Table 1. The 10 event types with the most deaths and injuries combined")
| Event type | Deaths | Injuries | Deaths + injuries |
|---|---|---|---|
| Heat | 472 | 273 | 745 |
| Tornado | 53 | 658 | 711 |
| Thunderstorm Wind | 53 | 161 | 214 |
| Flash Flood | 118 | 19 | 137 |
| Winter Weather | 25 | 87 | 112 |
| Rip Current | 65 | 42 | 107 |
| Hurricane (Typhoon) | 17 | 85 | 102 |
| Tropical Storm | 78 | 12 | 90 |
| Dense Fog | 18 | 65 | 83 |
| Dust Storm | 1 | 74 | 75 |
knitr::kable(head(arrange(health_by_type, desc(deaths)), 5), row.names = FALSE,
col.names = c("Event type", "Deaths", "Injuries", "Deaths + injuries"),
caption = "Table 2. The 5 event types with the most deaths")
| Event type | Deaths | Injuries | Deaths + injuries |
|---|---|---|---|
| Heat | 472 | 273 | 745 |
| Flash Flood | 118 | 19 | 137 |
| Tropical Storm | 78 | 12 | 90 |
| Rip Current | 65 | 42 | 107 |
| Tornado | 53 | 658 | 711 |
Code explanation:
fig.width = 9, fig.height = 5 set the
size of the figure in inches.head(health_by_type, 10) keeps the 10 most
harmful event types and saves them as top10.data.frame() builds two small
tables, one with each event type’s deaths and one with its injuries, and
the harm column labels which is which. rbind()
combines them as rows into one data frame, fig1_data, with
20 rows.factor() with levels sets the
order of the event types. rev() reverses the top 10 order,
because coord_flip() below draws the first level at the
bottom. Reversing it puts Heat at the top.harm. ggplot2 stacks the
last level closest to the axis, so listing “Deaths” second puts the
deaths at the start of each bar.ggplot() starts the plot with
fig1_data. aes() maps the event types to the
x-axis, the number of people to the y-axis, and harm to the
fill color.geom_col() draws bars using the actual values
in the data rather than counting rows. Each event type has two rows, so
its deaths and injuries stack in one bar.coord_flip() rotates the plot 90 degrees, so
the bars run sideways and the long event type names read left to
right.scale_fill_manual() sets the
colors, "firebrick" for deaths and "gray75"
for injuries. breaks lists deaths first in the legend.labs() sets the title and the axis
label. x = NULL removes the event type axis title, since
the names explain themselves, and fill = NULL removes the
legend title.theme_minimal() removes the heavy gray
background for a cleaner look.theme(plot.title = element_text(hjust = 0.5)) centers the
title.top10 <- head(health_by_type, 10)
fig1_data <- rbind(data.frame(EVENT_TYPE = top10$EVENT_TYPE, harm = "Deaths", people = top10$deaths),
data.frame(EVENT_TYPE = top10$EVENT_TYPE, harm = "Injuries", people = top10$injuries))
fig1_data$EVENT_TYPE <- factor(fig1_data$EVENT_TYPE, levels = rev(top10$EVENT_TYPE))
fig1_data$harm <- factor(fig1_data$harm, levels = c("Injuries", "Deaths"))
ggplot(fig1_data, aes(x = EVENT_TYPE, y = people, fill = harm)) +
geom_col() +
coord_flip() +
scale_fill_manual(values = c("Deaths" = "firebrick", "Injuries" = "gray75"),
breaks = c("Deaths", "Injuries")) +
labs(title = "Top 10 Storm Event Types by Deaths and Injuries, U.S. 2024",
x = NULL, y = "Number of people", fill = NULL) +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
Figure 1. Deaths (red) and injuries (gray), direct and indirect, for the 10 storm event types that harmed the most people in the United States in 2024. Each bar’s full length is the combined total. Heat (including Excessive Heat) caused the most combined harm with 745, followed closely by tornadoes with 711, but the two harm people differently. Most of the heat bar is deaths, while most of the tornado bar is injuries. After these two, harm drops sharply. Flash Flood’s bar is short, but most of it is deaths, which is why it ranks second in Table 2.
Answer: Heat (including Excessive Heat) was the most harmful event type in 2024, with 745 deaths and injuries, followed closely by tornadoes with 711. The two harm people in different ways. Heat caused far more deaths (472 vs. 53), while most tornado harm was injuries (658 of 711). Ranked by deaths alone, Flash Flood is second with 118, more than twice as many as tornadoes.
To answer this question, I used details_states, which
covers the 50 states and DC. For each of these 51 places, I counted how
many events of each type were recorded and kept the type with the
highest count. I also calculated what percent of each place’s events
that type made up, which shows how dominant it is. The table lists every
place with its most common event type, and Figure 2 shows the five
states with the most events for each of the six most common event
types.
Code explanation:
table() takes two variables, state and event
type, and creates a two-dimensional contingency table that counts how
many events of each type happened in each state.
as.data.frame() then turns that table into a data frame
with one row for each state and event type pair. The count for each pair
goes in a column named Freq.rename() gives the columns clear names, using
new_name = old_name.top_type_by_state <- saves the result, and
%>% passes state_type_counts to the next
step.group_by(STATE) groups the data by
state.mutate() creates percent, the
share of each state’s events that belong to each type. Because the data
are still grouped by state, sum(events) adds up only that
state’s events. round(..., 1) keeps one decimal place. This
step comes before filter() so that sum(events)
still includes every event type in the state.filter(events == max(events)) picks only the
row with the highest count within each state. That’s the most common
event type there.arrange(desc(events)) sorts the states from
the most events to the fewest.as.data.frame() turns the grouped result back
into a plain data frame.knitr::kable() prints all 51 rows as
a formatted table instead of raw console output. knitr::
calls the function from the knitr package without loading the whole
package. col.names gives the columns readable headings,
format.args = list(big.mark = ",") adds commas to large
numbers, and caption adds a title.n_events() is a small function that
returns how many events of one type happened in one state, using
state_type_counts. The & keeps only the
row where both the state and the event type match. The paragraphs below
use it to pull counts straight from the data instead of typing
them.state_type_counts <- as.data.frame(table(details_states$STATE, details_states$EVENT_TYPE)) %>%
rename(STATE = Var1, EVENT_TYPE = Var2, events = Freq)
top_type_by_state <- state_type_counts %>%
group_by(STATE) %>%
mutate(percent = round(events / sum(events) * 100, 1)) %>%
filter(events == max(events)) %>%
arrange(desc(events)) %>%
as.data.frame()
knitr::kable(top_type_by_state,
col.names = c("State", "Most common event type", "Events", "Percent of state's events"),
format.args = list(big.mark = ","),
caption = "Table 3. The most common event type in each of the 50 states and DC")
| State | Most common event type | Events | Percent of state’s events |
|---|---|---|---|
| TEXAS | Hail | 1,588 | 28.0 |
| OKLAHOMA | Heat | 1,479 | 42.2 |
| KANSAS | Thunderstorm Wind | 1,043 | 40.6 |
| NEW YORK | Thunderstorm Wind | 1,021 | 45.0 |
| GEORGIA | Thunderstorm Wind | 1,002 | 60.0 |
| PENNSYLVANIA | Thunderstorm Wind | 971 | 49.0 |
| ILLINOIS | Thunderstorm Wind | 959 | 37.3 |
| KENTUCKY | Thunderstorm Wind | 818 | 46.6 |
| VIRGINIA | Thunderstorm Wind | 732 | 40.4 |
| MISSOURI | Thunderstorm Wind | 723 | 30.6 |
| NORTH CAROLINA | Thunderstorm Wind | 696 | 44.3 |
| IOWA | Thunderstorm Wind | 659 | 26.0 |
| OHIO | Thunderstorm Wind | 639 | 43.7 |
| NEBRASKA | Thunderstorm Wind | 599 | 29.4 |
| CALIFORNIA | High Wind | 583 | 22.5 |
| ALABAMA | Thunderstorm Wind | 569 | 44.7 |
| TENNESSEE | Thunderstorm Wind | 504 | 30.1 |
| SOUTH DAKOTA | Thunderstorm Wind | 501 | 25.9 |
| SOUTH CAROLINA | Thunderstorm Wind | 491 | 43.6 |
| WEST VIRGINIA | Thunderstorm Wind | 481 | 30.5 |
| FLORIDA | Thunderstorm Wind | 475 | 33.0 |
| COLORADO | Heavy Snow | 439 | 23.2 |
| MONTANA | High Wind | 435 | 35.1 |
| INDIANA | Thunderstorm Wind | 426 | 39.0 |
| LOUISIANA | Thunderstorm Wind | 425 | 32.4 |
| MISSISSIPPI | Thunderstorm Wind | 419 | 30.7 |
| NEW MEXICO | Drought | 375 | 35.1 |
| MINNESOTA | Thunderstorm Wind | 363 | 23.5 |
| WISCONSIN | Thunderstorm Wind | 342 | 26.7 |
| ARKANSAS | Thunderstorm Wind | 329 | 26.4 |
| WYOMING | High Wind | 271 | 33.7 |
| MICHIGAN | Thunderstorm Wind | 263 | 37.5 |
| NEW JERSEY | Thunderstorm Wind | 262 | 36.4 |
| IDAHO | Thunderstorm Wind | 261 | 43.8 |
| ARIZONA | Heat | 250 | 36.3 |
| NEVADA | High Wind | 245 | 50.0 |
| UTAH | Thunderstorm Wind | 229 | 43.7 |
| MARYLAND | Thunderstorm Wind | 202 | 36.5 |
| NORTH DAKOTA | Hail | 174 | 24.3 |
| CONNECTICUT | Thunderstorm Wind | 128 | 44.4 |
| MAINE | Thunderstorm Wind | 127 | 25.7 |
| MASSACHUSETTS | Thunderstorm Wind | 127 | 40.4 |
| NEW HAMPSHIRE | Thunderstorm Wind | 109 | 41.4 |
| VERMONT | Winter Weather | 92 | 26.3 |
| WASHINGTON | Heavy Snow | 90 | 25.0 |
| ALASKA | Blizzard | 85 | 26.6 |
| HAWAII | High Surf | 77 | 42.8 |
| OREGON | Heavy Snow | 76 | 17.6 |
| DELAWARE | Thunderstorm Wind | 21 | 25.3 |
| DISTRICT OF COLUMBIA | Thunderstorm Wind | 11 | 39.3 |
| RHODE ISLAND | Thunderstorm Wind | 11 | 19.3 |
n_events <- function(state, type) {
state_type_counts$events[state_type_counts$STATE == state & state_type_counts$EVENT_TYPE == type]
}
Code explanation:
fig.width = 10, fig.height = 10 make the
figure big enough for six panels.table(details_states$EVENT_TYPE) counts how
many times each event type occurs in the 50 states and DC.
sort(..., decreasing = TRUE) orders them from most to least
common, head(..., 6) keeps the top 6, and
names() returns just the event type names. They’re saved as
top6_types.data.frame() with nothing inside creates an
empty data frame, fig2_data, that the loop below fills
in.for loop repeats the steps inside
{ } once for each event type in top6_types.
Each time through, type holds the current event type.details_states$EVENT_TYPE == type gives TRUE
for rows of the current type. Putting that inside [ ] keeps
only those rows’ states, saved as type_states.table(type_states) counts how many events of
the current type happened in each state.
sort(..., decreasing = TRUE) orders the states from most to
fewest, and head(..., 5) keeps the top 5, saved as
top5_states.data.frame() turns the current
type’s top 5 into five rows. names() gives the state names,
and as.numeric() gives the counts as plain numbers.
leader is TRUE only for the state with the most events.
rbind() adds these rows to the bottom of
fig2_data.} closes the loop.paste() joins each state and event type into
one label, such as “TEXAS___Hail”. Texas shows up in several panels, and
this gives each of its bars a unique name so each panel can sort its own
bars.factor() with levels keeps the
bars in the order the loop created them. rev() reverses
that order, because coord_flip() below draws the first
level at the bottom. Reversing it puts each panel’s leading state at the
top.ggplot() starts the plot with
fig2_data. aes() maps the bar labels to the
x-axis, the number of events to the y-axis, and leader to
the fill color.geom_col() draws bars using the actual
values in the data rather than counting rows.coord_flip() rotates the plot 90 degrees so
the long state names read left to right.facet_wrap(~ EVENT_TYPE) creates a separate
panel for each event type, with ncol = 2 putting them in
two columns. scales = "free" lets each panel show only its
own states and use its own number scale.scale_x_discrete() changes the bar labels.
gsub("___.*", "", x) removes the “___” and everything after
it, so only the state name shows.scale_fill_manual() colors the leading state
"steelblue" and the other states "gray80".
guide = "none" hides the legend, since the caption explains
the blue.labs() sets the title and the axis
label. x = NULL removes the state axis title.theme_minimal() removes the heavy gray
background for a cleaner look.theme(plot.title = element_text(hjust = 0.5)) centers the
title.top6_types <- names(head(sort(table(details_states$EVENT_TYPE), decreasing = TRUE), 6))
fig2_data <- data.frame()
for (type in top6_types) {
type_states <- details_states$STATE[details_states$EVENT_TYPE == type]
top5_states <- head(sort(table(type_states), decreasing = TRUE), 5)
fig2_data <- rbind(fig2_data,
data.frame(EVENT_TYPE = type,
STATE = names(top5_states),
events = as.numeric(top5_states),
leader = as.numeric(top5_states) == max(top5_states)))
}
fig2_data$bar_id <- paste(fig2_data$STATE, fig2_data$EVENT_TYPE, sep = "___")
fig2_data$bar_id <- factor(fig2_data$bar_id, levels = rev(fig2_data$bar_id))
fig2_data$EVENT_TYPE <- factor(fig2_data$EVENT_TYPE, levels = top6_types)
ggplot(fig2_data, aes(x = bar_id, y = events, fill = leader)) +
geom_col() +
coord_flip() +
facet_wrap(~ EVENT_TYPE, ncol = 2, scales = "free") +
scale_x_discrete(labels = function(x) gsub("___.*", "", x)) +
scale_fill_manual(values = c("TRUE" = "steelblue", "FALSE" = "gray80"), guide = "none") +
labs(title = "Top 5 States for Each of the 6 Most Common Event Types, U.S. 2024",
x = NULL, y = "Number of events") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
Figure 2. Number of events in the five states, out of the 50 states and DC, with the most events for each of the six most common storm event types in the U.S. in 2024. The figure has six panels, one per event type, arranged in order from the most common type overall (Thunderstorm Wind) to the sixth most common (Winter Weather). Within each panel, the states run from the most events at the top to the fifth most at the bottom, and the leading state is highlighted in blue. Each bar is one state’s count, not the national total. Each panel has its own scale, so compare the pattern within a panel, not the bar lengths across panels. Texas appears in 5 of the 6 panels, more than any other state.
Answer: Thunderstorm Wind was the most common event type in 36 of the 51 places (the 50 states and DC). The other 15 places most often recorded events that fit their local climate. In the West, High Wind led in California, Montana, Nevada, and Wyoming, and Heavy Snow led in Colorado, Washington, and Oregon. In the Southwest and the Plains, Heat led in Oklahoma and Arizona, Hail led in Texas and North Dakota, and Drought led in New Mexico. Alaska, Hawaii, and Vermont each had a top event of their own: Blizzard, High Surf, and Winter Weather.
Looking at the same data by event type, Figure 2 shows that the most common event types are not distributed across the country in the same way. Some are concentrated in one or two states. Texas recorded 1,588 Hail events, about twice as many as Kansas (767) or Oklahoma (765), and Heat is even more localized, with Oklahoma (1,479) and Texas (1,164) each recording more than three times as many Heat events as Mississippi (358). Texas also led Flash Flood with 539 events, well ahead of North Carolina (367). Other event types cluster by region. Hail centers on the Plains, and High Wind on the West, led by California (583) and Montana (435). In two event types, the leading state is barely ahead of the next one. Kansas led Thunderstorm Wind with 1,043 events, only 22 more than New York (1,021), and all five of its top states fall between 971 and 1,043. In Winter Weather, New York (283) led Colorado (273) by only 10 events. Thunderstorm Wind occurs at similar levels in many states, which helps explain why it was the most common event type in 36 of the 51 places.
Some states’ top types come from thousands of events, while others come from only a handful. Hail in Texas comes from 1,588 events, but Thunderstorm Wind in DC and Rhode Island comes from only 11 events each. In Rhode Island, Flash Flood, Heavy Snow, and High Wind each had 9 events, so the top type there could easily change in another year.
The percent column in Table 3 shows how dominant each top type is within its state. Thunderstorm Wind made up 60% of Georgia’s events, while Heavy Snow made up only 17.6% of Oregon’s, so Oregon has no single dominant event type. This column also helps with a limit of the raw counts. States that record more events overall, such as Texas, tend to fill the top spots in Figure 2. The percent column compares each type with that state’s own total, so large and small states are on the same scale.
To answer this question, I focused on the 10 most common event types, which together make up about 82% of all events in 2024. Many of the remaining types are rare. Some, such as Lakeshore Flood and Marine Tropical Depression, have only one event all year, so a peak month would say almost nothing about them. For each of the 10 types, I counted the events in each month and found its peak month, the month with the most events. A peak month alone does not show whether an event type happens in one season or all year, so Figure 3 shows the number of events in all 12 months for each of the 10 types, with the peak month highlighted in blue.
Code explanation:
table(details$EVENT_TYPE) counts the
occurrences of each event type.
sort(..., decreasing = TRUE) orders them from most to least
common, head(..., 10) keeps the top 10, and
names() returns just the event type names. They’re saved as
top10_types.filter() with %in%
picks only the events whose type appears in top10_types,
and saves them as top_types_data.table() takes two variables, event type and
month, and creates a two-dimensional contingency table that counts how
many events of each type happened in each month.
as.data.frame() then turns that table into a data frame
with one row for each event type and month pair. The count for each pair
goes in a column named Freq.rename() gives the columns clear names.group_by(EVENT_TYPE) groups the data
by event type, and filter(events == max(events)) keeps the
month with the most events for each type. That’s its peak month.arrange(MONTH) sorts the results in calendar
order. This works because MONTH_NAME is the factor I
created during cleaning.as.data.frame() turns the grouped result back
into a plain data frame.knitr::kable() prints the table
with readable column names, commas in large numbers, and a caption.nrow() counts the rows in
top_types_data and in details. Dividing the
first by the second and multiplying by 100 gives the percent of all
events that belong to the 10 most common types.
round(..., 1) keeps one decimal place. R leaves off a
decimal that ends in zero, so 82.0 prints as 82.flood_months stores Flood’s number of events
in each month. The Answer below uses it to report Flood’s January and
June counts straight from the data.top10_types <- names(head(sort(table(details$EVENT_TYPE), decreasing = TRUE), 10))
top_types_data <- details %>%
filter(EVENT_TYPE %in% top10_types)
peak_month_by_type <- as.data.frame(table(top_types_data$EVENT_TYPE, top_types_data$MONTH_NAME)) %>%
rename(EVENT_TYPE = Var1, MONTH = Var2, events = Freq) %>%
group_by(EVENT_TYPE) %>%
filter(events == max(events)) %>%
arrange(MONTH) %>%
as.data.frame()
knitr::kable(peak_month_by_type,
col.names = c("Event type", "Peak month", "Events in peak month"),
format.args = list(big.mark = ","),
caption = "Table 4. Peak month for each of the 10 most common event types")
| Event type | Peak month | Events in peak month |
|---|---|---|
| Flood | January | 396 |
| Heavy Snow | January | 660 |
| High Wind | January | 674 |
| Winter Weather | January | 1,584 |
| Hail | May | 3,244 |
| Thunderstorm Wind | May | 4,638 |
| Heat | July | 1,982 |
| Flash Flood | August | 935 |
| Marine Thunderstorm Wind | August | 435 |
| Drought | November | 648 |
round(nrow(top_types_data) / nrow(details) * 100, 1)
## [1] 82
flood_months <- table(top_types_data$MONTH_NAME[top_types_data$EVENT_TYPE == "Flood"])
Code explanation:
fig.width = 10, fig.height = 12 make the
figure big enough for ten panels.table() counts how many events of each of the
10 types happened in each month, and as.data.frame() turns
that into a data frame with one row for each event type and month pair.
%>% passes it to the next step.rename() gives the columns clear names.group_by(EVENT_TYPE) groups the rows by event
type.mutate() creates peak, which is
TRUE for the month with the most events of each type. Because the data
are grouped, max(events) finds the highest month within
each type.as.data.frame() turns the grouped result back
into a plain data frame, saved as fig3_data.factor() with
levels = top10_types orders the panels from the most common
event type to the tenth most common.ggplot() starts the plot with
fig3_data. aes() maps the months to the
x-axis, the number of events to the y-axis, and peak to the
fill color. MONTH keeps the calendar order from the factor
I created during cleaning.geom_col() draws bars using the actual values
in the data rather than counting rows.facet_wrap(~ EVENT_TYPE) creates a separate
panel for each event type, with ncol = 2 putting them in
two columns. scales = "free_y" gives each panel its own
y-axis scale, so rare and common types are both readable.scale_x_discrete() labels the months with
their first letters so the labels fit.scale_fill_manual() colors the peak month
"steelblue" and the other months "gray80".
guide = "none" hides the legend, since the caption explains
the blue.labs() sets the title and the axis
labels.theme_minimal() removes the heavy gray
background for a cleaner look.theme(plot.title = element_text(hjust = 0.5)) centers the
title.fig3_data <- as.data.frame(table(top_types_data$EVENT_TYPE, top_types_data$MONTH_NAME)) %>%
rename(EVENT_TYPE = Var1, MONTH = Var2, events = Freq) %>%
group_by(EVENT_TYPE) %>%
mutate(peak = events == max(events)) %>%
as.data.frame()
fig3_data$EVENT_TYPE <- factor(fig3_data$EVENT_TYPE, levels = top10_types)
ggplot(fig3_data, aes(x = MONTH, y = events, fill = peak)) +
geom_col() +
facet_wrap(~ EVENT_TYPE, ncol = 2, scales = "free_y") +
scale_x_discrete(labels = c("J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D")) +
scale_fill_manual(values = c("TRUE" = "steelblue", "FALSE" = "gray80"), guide = "none") +
labs(title = "Events per Month for the 10 Most Common Event Types, U.S. 2024",
x = "Month", y = "Number of events") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
Figure 3. Number of events per month (January through December) for the 10 most common storm event types in the U.S. in 2024, with each type’s peak month highlighted in blue. Each panel has its own y-axis scale, so compare the shape of each pattern, not the bar heights across panels. Three patterns stand out. Winter Weather and Heavy Snow are cold-season events that drop to almost nothing in summer, and High Wind falls to its lowest point in July and August. Thunderstorm Wind, Hail, Heat, Flash Flood, and Marine Thunderstorm Wind are warm-season events, and Heat is the most concentrated, with nearly all of its events in June through August. Flood and Drought happen all year, although Drought is most common in the fall.
Answer: Most storm event types follow a clear seasonal pattern. Winter Weather, Heavy Snow, and High Wind peak in January and are least common in summer. Hail and Thunderstorm Wind peak in May, Heat peaks in July, and Flash Flood and Marine Thunderstorm Wind peak in August, all during the warm months. Drought peaks in November. Flood is the exception. It technically peaks in January (396 events), but June is close behind (358), so it has no single season.
This is my own question. Question 1 ranked event types by harm to
people, but a manager preparing for severe weather also has to plan for
repair costs. If the same event types led both rankings, one plan could
cover both. To answer it, I added up property and crop damage for each
event type, using the dollar amounts created during cleaning, ranked the
types from most to least damaging, and compared that ranking with
Question 1. I used the full details table, and the totals
include only events with a reported damage estimate. Table 5 shows
damage in millions of dollars and the number of events of each type, so
a type with a few very costly events can be told apart from a type with
many smaller ones. It also shows how many events of each type have no
property damage estimate, because a type with many missing estimates
could look cheaper than it really is. Figure 4 plots each event type’s
damage against its harm to people, so the two rankings can be compared
in one picture.
Code explanation:
damage_by_type <- saves the result, and
%>% passes details to the next step.group_by() groups the data by
EVENT_TYPE.summarize() generates summary statistics for
each event type. length(EVENT_ID) counts the events in each
type.is.na() returns TRUE for each event with no
property damage estimate, and sum() counts the TRUEs. This
gives the number of events of each type with no estimate.sum() adds up property damage and
crop damage, and na.rm = TRUE tells sum() to
ignore events with no damage estimate. Dividing by 1,000,000 converts
the totals to millions of dollars.mutate() creates a new variable with the
combined property and crop damage for each event type.round(..., digits = 1) rounds each
damage column to one decimal place so the table is easier to read.arrange(desc()) sorts the event types from
the most damage to the least.as.data.frame() turns the result into a
plain data frame so the next line can give it row names.rownames() names each row after its event
type, the same way as in Question 1.knitr::kable() prints the 10 most
damaging event types as a formatted table.
row.names = FALSE hides the row names,
col.names gives readable headings,
format.args = list(big.mark = ",") adds commas to large
numbers, and caption adds a title.damage_by_type["Heat", c(...)] uses the row
name to print Heat’s number of events, number with no estimate, and
total damage. Heat is not in the top 10, so this line lets the
comparison with Question 1 be checked.details$EVENT_TYPE == "Heat" & details$PROPERTY_DMG == 0
is TRUE for heat events recorded with $0 in property damage.
& requires both conditions to be TRUE.
sum() counts them, and na.rm = TRUE skips
events with no estimate. The count is saved as
heat_zero_damage.heat_zero_damage.damage_by_type <- details %>%
group_by(EVENT_TYPE) %>%
summarize(events = length(EVENT_ID),
no_estimate = sum(is.na(PROPERTY_DMG)),
property_millions = sum(PROPERTY_DMG, na.rm = TRUE) / 1000000,
crop_millions = sum(CROP_DMG, na.rm = TRUE) / 1000000) %>%
mutate(total_millions = property_millions + crop_millions) %>%
mutate(property_millions = round(property_millions, digits = 1),
crop_millions = round(crop_millions, digits = 1),
total_millions = round(total_millions, digits = 1)) %>%
arrange(desc(total_millions)) %>%
as.data.frame()
rownames(damage_by_type) <- damage_by_type$EVENT_TYPE
knitr::kable(head(damage_by_type, 10), row.names = FALSE,
col.names = c("Event type", "Events", "No property estimate",
"Property", "Crop", "Total"),
format.args = list(big.mark = ","),
caption = "Table 5. The 10 event types with the most property and crop damage, in millions of dollars")
| Event type | Events | No property estimate | Property | Crop | Total |
|---|---|---|---|---|---|
| Hurricane (Typhoon) | 76 | 26 | 5,302.6 | 1,510.0 | 6,812.6 |
| Flash Flood | 4,661 | 0 | 3,143.4 | 101.6 | 3,245.0 |
| Tropical Storm | 544 | 101 | 1,902.0 | 253.0 | 2,155.0 |
| Tornado | 2,138 | 363 | 1,721.0 | 8.5 | 1,729.6 |
| Wildfire | 336 | 44 | 1,102.9 | 64.8 | 1,167.7 |
| Storm Surge/Tide | 71 | 11 | 870.0 | 0.0 | 870.0 |
| Flood | 2,472 | 0 | 649.0 | 4.9 | 653.9 |
| Thunderstorm Wind | 19,940 | 3,993 | 412.5 | 29.1 | 441.6 |
| Hail | 8,941 | 2,852 | 227.0 | 142.9 | 369.8 |
| High Wind | 3,994 | 975 | 128.0 | 112.6 | 240.6 |
damage_by_type["Heat", c("events", "no_estimate", "total_millions")]
## events no_estimate total_millions
## Heat 5831 1921 0
heat_zero_damage <- sum(details$EVENT_TYPE == "Heat" & details$PROPERTY_DMG == 0, na.rm = TRUE)
heat_zero_damage
## [1] 3908
Code explanation:
fig.width = 9, fig.height = 6 set the
size of the figure in inches.head(..., 10) takes the top 10 event
types from Question 1 and from Question 4, and c() combines
the two lists. %in% checks which event types in
health_by_type appear in that combined list, and
[ ] keeps those names. Each type appears only once, even if
it is in both top 10 lists. They’re saved as
fig4_types.data.frame() builds a table with one
row per event type. The row names from Questions 1 and 4 pull each
type’s health total and damage. Dividing the damage by 1,000 converts
millions to billions of dollars. The table is saved as
fig4_data.c() combines the top 5 event types from each
ranking, saved as top5_either.ifelse() gives each event type in
top5_either its name as a label and gives every other type
an empty label "". Only the most important points are
labeled, so the names don’t pile on top of each other.ggplot() starts the plot with
fig4_data. aes() maps damage to the x-axis,
health total to the y-axis, and label to the text
labels.geom_point() draws a point for each event
type. color = "steelblue" sets the color, and
size = 3 makes the points large enough to see.geom_text() adds the labels.
nudge_y = 30 moves each label up so it does not cover its
point, and hjust = "inward" pulls labels near the edges
toward the center so they don’t get cut off.labs() sets the title and the axis
labels.theme_minimal() removes the heavy gray
background for a cleaner look.theme(plot.title = element_text(hjust = 0.5)) centers the
title.fig4_types <- health_by_type$EVENT_TYPE[health_by_type$EVENT_TYPE %in%
c(head(health_by_type$EVENT_TYPE, 10), head(damage_by_type$EVENT_TYPE, 10))]
fig4_data <- data.frame(EVENT_TYPE = fig4_types,
health_total = health_by_type[fig4_types, "health_total"],
damage_billions = damage_by_type[fig4_types, "total_millions"] / 1000)
top5_either <- c(head(health_by_type$EVENT_TYPE, 5), head(damage_by_type$EVENT_TYPE, 5))
fig4_data$label <- ifelse(fig4_data$EVENT_TYPE %in% top5_either, fig4_data$EVENT_TYPE, "")
ggplot(fig4_data, aes(x = damage_billions, y = health_total, label = label)) +
geom_point(color = "steelblue", size = 3) +
geom_text(nudge_y = 30, hjust = "inward", size = 3.5) +
labs(title = "Damage vs. Harm to People by Event Type, U.S. 2024",
x = "Property and crop damage (billions of dollars)",
y = "Deaths and injuries") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
Figure 4. Property and crop damage, in billions of dollars, against deaths and injuries for the 15 event types that are in the top 10 of either Question 1 or Question 4. The labeled points are in the top 5 of either ranking. The Winter Weather label belongs to the highest of the four points stacked at about $0, and the three below it are Rip Current, Dense Fog, and Dust Storm. The four unlabeled points between $0.2 and $0.9 billion are, from left to right, High Wind, Hail, Flood, and Storm Surge/Tide. No event type sits in the upper right corner, where high damage meets high harm, so event types tend to be high on one measure or the other, not both. Heat sits at the top left, with 745 deaths and injuries but almost no recorded damage. Hurricanes sit at the far right, with about $6.8 billion in damage but only 102 deaths and injuries. Tornadoes come closest to being high on both, with 711 deaths and injuries and about $1.7 billion in damage. Damage totals include only events with a reported estimate, so the true costs are likely higher.
Answer: Hurricanes caused the most economic damage in 2024 (about $6.8 billion), followed by Flash Floods (about $3.2 billion), Tropical Storms (about $2.2 billion), and Tornadoes (about $1.7 billion). How often an event happens does not predict how much it costs. Hurricanes had only 76 events, while Thunderstorm Wind, the most common event type with 19,940 events, ranks only 8th in damage. The event types that cost the most are mostly not the ones that harm the most people. Flash Flood and Tornado are the only event types in the top four of both rankings. Heat caused the most deaths and injuries but has almost no recorded damage, and missing estimates do not explain this. Of its 5,831 events, 3,908 were recorded with $0 in property damage, and only 1,921 have no estimate. NOAA’s damage columns measure harm to property and crops, so they don’t capture costs of heat that fall outside those two areas.
Question 1 showed which event types killed the most people. The
fatalities file adds where each person died, which matters for
prevention, because a manager can only protect people in the places
where they are at risk. This file has one row per person who died, so I
joined it to each event’s type from the details table using
EVENT_ID. Each death belongs to exactly one event, so this
join does not repeat rows the way the three-file join did. Across all
deaths in the fatalities file, I kept the five most common known
locations, grouped the rare ones (such as Under Tree, Boating, and
Camping) into Other, and kept Unknown as its own group. Figure 5 shows
the share of deaths in each location for the six event types with the
most deaths.
Code explanation:
fatal_types <- saves the result, and
%>% passes fatalities to the next
step.select() keeps only EVENT_ID and
EVENT_TYPE from details, and
left_join() adds each death’s event type by matching
EVENT_ID. details already has Heat and
Excessive Heat combined.mutate() creates
LOCATION. ifelse() keeps the location if it is
one of the six listed with %in%, and otherwise uses
“Other”.c() puts the number of rows before and after
the join side by side. They should match, which shows the join did not
repeat any rows.arrange(desc(deaths)) sorts
health_by_type by deaths, $EVENT_TYPE takes
the event type names, and head(..., 6) keeps the six
deadliest types. They’re saved as top6_deadly.filter() with %in%
keeps only deaths from the six deadliest event types, saved as
fig5_deaths.table() takes two variables, event type and
location, and counts the deaths for each pair.
as.data.frame() turns that table into a data frame with one
row per pair, with the count in a column named Freq. This
is the same approach as the Question 2 table.rename() gives the columns clear names.group_by(EVENT_TYPE) groups the rows by
event type.mutate() creates two new
variables. Because the data are grouped by event type,
sum(deaths) adds up only that type’s deaths, which is saved
as total. percent divides each location’s
deaths by that sum and multiplies by 100. This is the same step that
made the percent column in Question 2.as.data.frame() turns the grouped result
back into a plain data frame.fatal_types <- fatalities %>%
left_join(select(details, EVENT_ID, EVENT_TYPE), by = "EVENT_ID") %>%
mutate(LOCATION = ifelse(FATALITY_LOCATION %in% c("Outside/Open Areas", "Permanent Home",
"Mobile/Trailer Home", "Vehicle/Towed Trailer",
"In Water", "Unknown"),
FATALITY_LOCATION, "Other"))
c(nrow(fatalities), nrow(fatal_types))
## [1] 1142 1142
top6_deadly <- head(arrange(health_by_type, desc(deaths))$EVENT_TYPE, 6)
fig5_deaths <- fatal_types %>%
filter(EVENT_TYPE %in% top6_deadly)
fig5_data <- as.data.frame(table(fig5_deaths$EVENT_TYPE, fig5_deaths$LOCATION)) %>%
rename(EVENT_TYPE = Var1, LOCATION = Var2, deaths = Freq) %>%
group_by(EVENT_TYPE) %>%
mutate(total = sum(deaths),
percent = deaths / sum(deaths) * 100) %>%
as.data.frame()
nrow(fatalities)
## [1] 1142
sum(details$DEATHS_DIRECT + details$DEATHS_INDIRECT)
## [1] 1141
The join kept all 1,142 rows. The fatalities file lists 1,142 deaths and the details file counts 1,141, so the two files agree almost exactly. The two files are recorded separately, so the totals in Figure 5 can differ from Table 2 by about one death.
Code explanation:
fig.width = 10, fig.height = 5 set the
size of the figure in inches.table() counts the deaths for every event
type in fatal_types, and [top6_deadly] keeps
the six deadliest in order. They’re saved as
fig5_totals.paste() builds a label for each event type
with its number of deaths, such as “Tornado (54 deaths)”.
sep = "" joins the pieces with no extra spaces.fig5_data. factor() with
levels = rev(type_labels) sets the order of the bars.
coord_flip() draws the first level at the bottom, so
reversing the order puts the deadliest type at the top.factor() sets the order of the
locations. ggplot2 stacks the last level closest to the axis, so this
order puts Outside/Open Areas at the start of each bar and Unknown at
the end.ggplot() starts the plot with
fig5_data. aes() maps the event type labels to
the x-axis, percent to the y-axis, and
LOCATION to the fill color.geom_col() draws the stacked bars using the
actual values in the data. color = "white" draws a thin
white line between the pieces so neighboring colors are easy to tell
apart.geom_text() prints the percent on
each piece that is at least 10% of its bar. ifelse() gives
smaller pieces an empty label so their numbers don’t crowd.
round() drops the decimals, and
position_stack(vjust = 0.5) centers each label in its
piece.coord_flip() rotates the plot 90 degrees so
the bars run sideways and the labels read left to right.scale_fill_manual() sets a color
for each location. The five known locations use colors from
ColorBrewer’s Set2 qualitative palette, chosen so the five colors stay
easy to tell apart, including for viewers with common types of color
blindness. Each color is written as a hex code, a six-character code for
one color, such as #FC8D62 for orange. Running
RColorBrewer::brewer.pal(n = 6, name = "Set2") in the
console prints the palette these codes come from. Other and Unknown stay
gray so the known locations stand out. breaks sets the
order of the legend.labs() sets the title, the axis
label, and the legend title.theme_minimal() removes the heavy gray
background for a cleaner look.theme(plot.title = element_text(hjust = 0.5)) centers the
title.fig5_totals <- table(fatal_types$EVENT_TYPE)[top6_deadly]
type_labels <- paste(top6_deadly, " (", fig5_totals, " deaths)", sep = "")
fig5_data$label <- factor(paste(fig5_data$EVENT_TYPE, " (", fig5_data$total, " deaths)", sep = ""),
levels = rev(type_labels))
fig5_data$LOCATION <- factor(fig5_data$LOCATION,
levels = c("Unknown", "Other", "In Water", "Vehicle/Towed Trailer",
"Mobile/Trailer Home", "Permanent Home", "Outside/Open Areas"))
ggplot(fig5_data, aes(x = label, y = percent, fill = LOCATION)) +
geom_col(color = "white") +
geom_text(aes(label = ifelse(percent >= 10, paste(round(percent), "%", sep = ""), "")),
position = position_stack(vjust = 0.5), size = 3.5) +
coord_flip() +
scale_fill_manual(values = c("Outside/Open Areas" = "#FC8D62", "Permanent Home" = "#66C2A5",
"Mobile/Trailer Home" = "#FFD92F", "Vehicle/Towed Trailer" = "#A6D854",
"In Water" = "#8DA0CB", "Other" = "gray60", "Unknown" = "gray85"),
breaks = c("Outside/Open Areas", "Permanent Home", "Mobile/Trailer Home",
"Vehicle/Towed Trailer", "In Water", "Other", "Unknown")) +
labs(title = "Where People Died, for the 6 Deadliest Event Types, U.S. 2024",
x = NULL, y = "Percent of the event type's deaths", fill = "Location") +
theme_minimal() +
theme(plot.title = element_text(hjust = 0.5))
Figure 5. Where people died, as a percent of each event type’s deaths, for the six event types with the most deaths in the U.S. in 2024. The number after each event type is its total deaths in the fatalities file, and pieces of at least 10% are labeled. Each event type has its own pattern. Most tornado deaths (59%) happened in mobile or trailer homes, and nearly all rip current deaths (97%) happened in the water. Tropical storm deaths happened most often in permanent homes (44%). Flash flood deaths were spread across permanent homes (29%), vehicles (21%), and outdoor areas (21%). The location is unknown for 68% of heat deaths, so the heat bar says little about where heat deaths happen. Of the heat deaths with a known location, most happened outdoors.
Takeaway: The deadliest event types kill people in different places, so preventing deaths takes a different plan for each one. Tornado deaths point to mobile and trailer homes, rip current deaths point to beaches, and flash flood deaths point to homes, roads, and outdoor areas. Heat is the exception. NOAA records no location for most heat deaths, so this data cannot show where to focus heat prevention.
This analysis covers 2024 only, so the rankings and seasonal patterns may differ in other years. Weather varies a lot from one year to the next. Hurricane damage in this report comes from only 76 events, so a year with fewer or weaker hurricanes reaching land could rank very differently. Longer-term changes in climate, such as rising temperatures, could also change how often events like heat and drought happen over time. Growth in population and building in areas exposed to storms can raise damage costs even when the weather itself does not change.
Some results depend on choices I made during cleaning. Heat ranks first in Question 1 only because I combined Heat and Excessive Heat. Kept separate, each has fewer deaths and injuries than tornadoes (392 and 353, compared with 711). The health total also counts a death and an injury the same way, so it does not reflect how much more serious a death is. Damage totals count only events with a reported estimate. Of the 69,802 events, 15,046 have no property damage estimate and 15,413 have no crop damage estimate, so the true costs are likely higher. This applies even to hurricanes, since 26 of the 76 hurricane events have no property damage estimate. Questions 2 and 3 count how often each event type occurred, not how much harm it caused, so a state’s most common event type or a type’s peak month is not necessarily where or when it is most dangerous. The counts are also not adjusted for state size or population, so states that record more events overall, such as Texas, appear more often in Figure 2. In Figure 5, the location is unknown for 68% of heat deaths, so the location results do not apply to heat. NOAA continues to revise its records after publication, and these results reflect the version of the files created on November 19, 2026.
To support reproducibility, I recorded the R version, operating system, and package versions used to produce this report. Packages change over time, and a newer version of dplyr or readr could print different messages or handle the data differently. With this record, anyone rerunning the report can match my setup or explain a difference in their results.
Code explanation:
sessionInfo() records the details of the
active R session automatically, instead of them being written down by
hand. It prints the R version, the operating system, and the version of
every package loaded in the current session.sessionInfo()
## R version 4.6.1 (2026-06-24)
## Platform: aarch64-apple-darwin23
## Running under: macOS Tahoe 26.7.3
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.6/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: America/New_York
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggplot2_4.0.3 readr_2.2.0 dplyr_1.2.1
##
## loaded via a namespace (and not attached):
## [1] gtable_0.3.6 jsonlite_2.0.0 compiler_4.6.1 tidyselect_1.2.1
## [5] jquerylib_0.1.4 scales_1.4.0 yaml_2.3.12 fastmap_1.2.0
## [9] R6_2.6.1 labeling_0.4.3 generics_0.1.4 knitr_1.51
## [13] tibble_3.3.1 bslib_0.11.0 pillar_1.11.1 RColorBrewer_1.1-3
## [17] tzdb_0.5.0 rlang_1.3.0 utf8_1.2.6 cachem_1.1.0
## [21] xfun_0.60 sass_0.4.10 S7_0.2.2 otel_0.2.0
## [25] cli_3.6.6 withr_3.0.3 magrittr_2.0.5 digest_0.6.39
## [29] grid_4.6.1 rstudioapi_0.19.0 hms_1.1.4 lifecycle_1.0.5
## [33] vctrs_0.7.3 evaluate_1.0.5 glue_1.8.1 farver_2.1.2
## [37] rmarkdown_2.31 tools_4.6.1 pkgconfig_2.0.3 htmltools_0.5.9