Traumatic Brain Injury

Traumatic Brain Injury

March 25, 2020
Medium: R and ggplot2
Large: JPEG

What are the primary causes of traumatic brain injury (TBI)? And how do they affect different age groups?

In this post, we dive into a dataset from the CDC on TBI cases from 2014 to find out.

library(tidyverse)
library(ggtext)

tbi <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-24/tbi_age.csv")

tbi
# A tibble: 231 x 5
   age_group type                       injury_mechanism                                  number_est rate_est
   <chr>     <chr>                      <chr>                                                  <dbl>    <dbl>
 1 0-17      Emergency Department Visit Motor Vehicle Crashes                                  47138     64.1
 2 0-17      Emergency Department Visit Unintentional Falls                                   397190    540. 
 3 0-17      Emergency Department Visit Unintentionally struck by or against an object        229236    312. 
 4 0-17      Emergency Department Visit Other unintentional injury, mechanism unspecified      55785     75.8
 5 0-17      Emergency Department Visit Intentional self-harm                                     NA     NA  
 6 0-17      Emergency Department Visit Assault                                                24360     33.1
 7 0-17      Emergency Department Visit Other or no mechanism specified                        57983     78.8
 8 0-4       Emergency Department Visit Motor Vehicle Crashes                                   5464     27.5
 9 0-4       Emergency Department Visit Unintentional Falls                                   230776   1161  
10 0-4       Emergency Department Visit Unintentionally struck by or against an object         53436    269. 
# … with 221 more rows

From Table 1 in the CDC’s TBI Surveillance Report, we can safely drop the 0-17 age group, because it’s not included in the final total and its cases are covered in the 0-4, 5-14, and 15-24 categories instead, and we can drop the Total group. Furthermore, it appears cases of intentional self-harm were not recorded for children. We’ll drop these rows, but make a note of that in the final visualization. Let’s also change the “Emergency Department Visit” and “Hospitalization” groups to reflect that they were non-lethal TBIs, whereas “Deaths” reflects lethal TBIs.

tbi <- tbi %>%
  filter(age_group != "Total", age_group != "0-17", !is.na(number_est)) %>%
  mutate(type = recode(type, "Emergency Department Visit" = "Non-lethal TBI (98% of cases)", "Hospitalizations" = "Non-lethal TBI (98% of cases)", "Deaths" = "Lethal TBI (2% of cases)")) %>%
  group_by(type, injury_mechanism, age_group) %>%
  summarize(number_est = sum(number_est)) %>%
  ungroup() %>%
  mutate(
    injury_mechanism = recode(injury_mechanism, !!! injury_mechanism_recodes),
    injury_mechanism = fct_relevel(injury_mechanism, rev(c("Intentional Self-harm", "Assault", "Motor Vehicle Crash", "Unintentional Fall", "Unintentionally Struck by an Object", "Other/Unknown"))),
    age_group = fct_relevel(age_group, c("0-4", "5-14", "15-24", "25-34", "35-44", "45-54", "55-64", "65-74", "75+"))
  )

tbi
# A tibble: 122 x 4
   type                     injury_mechanism      age_group number_est
   <chr>                    <fct>                 <fct>          <dbl>
 1 Lethal TBI (2% of cases) Assault               0-4              322
 2 Lethal TBI (2% of cases) Assault               15-24           1165
 3 Lethal TBI (2% of cases) Assault               25-34           1110
 4 Lethal TBI (2% of cases) Assault               35-44            732
 5 Lethal TBI (2% of cases) Assault               45-54            633
 6 Lethal TBI (2% of cases) Assault               5-14             117
 7 Lethal TBI (2% of cases) Assault               55-64            410
 8 Lethal TBI (2% of cases) Assault               65-74            241
 9 Lethal TBI (2% of cases) Assault               75+              174
10 Lethal TBI (2% of cases) Intentional Self-harm 15-24           2171
# … with 112 more rows

Define another dataframe with category annotations, which we’ll call injury_labels, and define unique colors for the visualization: a bright color palette for the TBI causes, a dark background color, and light text color. And finally make the plot!

injury_labels <- tribble(
  ~type, ~injury_mechanism, ~age_group, ~prop,
  "Lethal TBI (2% of cases)", "Intentional Self-harm", "25-34", 0.2,
  "Lethal TBI (2% of cases)", "Assault", "25-34", 0.5,
  "Lethal TBI (2% of cases)", "Motor Vehicle Crash", "5-14", 0.66,
  "Lethal TBI (2% of cases)", "Unintentional Fall", "45-54", 0.8,
  "Lethal TBI (2% of cases)", "Other/Unknown", "45-54", 0.94,
  "Non-lethal TBI (98% of cases)", "Assault", "25-34", 0.07,
  "Non-lethal TBI (98% of cases)", "Motor Vehicle Crash", "15-24", 0.26,
  "Non-lethal TBI (98% of cases)", "Unintentional Fall", "35-44", 0.55,
  "Non-lethal TBI (98% of cases)", "Unintentionally Struck by an Object", "0-4", 0.79,
  "Non-lethal TBI (98% of cases)", "Other/Unknown", "15-24", 0.93
)

background_color <- "grey15"
text_color <- "grey85"

selfharm_color <- "#FFD700"
assault_color <- "#FFB14E"
mvcrash_color <- "#FA8775"
unfall_color <- "#EA5F94"
unstruck_color <- "#CD34B5"
other_color <- "#9D02D7"

ggplot() +
  geom_col(data = tbi, aes(x = age_group, y = number_est, fill = injury_mechanism), position = "fill", width = 1) +
  geom_text(data = injury_labels, aes(x = age_group, y = prop, label = injury_mechanism), color = "grey15", size = 4.5, family = "Fira Sans Extra Condensed Light", hjust = 0) +
  facet_wrap(. ~ type, ncol = 2) +
  scale_x_discrete(labels = c(" 5", seq(15, 75, by = 10), "")) +
  scale_fill_manual(values = rev(c(selfharm_color, assault_color, mvcrash_color, unfall_color, unstruck_color, other_color))) +
  guides(fill = FALSE) +
  labs(title = "In 2014, the United States recorded 2.87 million cases of traumatic brain injury (TBI)",
       subtitle = glue::glue("Nearly 2% of TBI cases were lethal, resulting in 56,800 deaths, including 2,529 deaths among children. The primary causes of<br>TBI are <span style='color:{selfharm_color};font-family:\"Fira Sans Extra Condensed\"'>Intentional Self-harm</span>*, <span style='color:{assault_color};font-family:\"Fira Sans Extra Condensed\"'>Assault</span>, a <span style='color:{mvcrash_color};font-family:\"Fira Sans Extra Condensed\"'>Motor Vehicle Crash</span>, an <span style='color:{unfall_color};font-family:\"Fira Sans Extra Condensed\"'>Unintentional Fall</span>, and being <span style='color:{unstruck_color};font-family:\"Fira Sans Extra Condensed\"'>Unintentionally Struck by an<br>Object</span>. About 10% of remaining cases are of <span style='color:{other_color};font-family:\"Fira Sans Extra Condensed\"'>Other/Unknown</span> cause. The relative rates of these causes change by <span style='font-family:\"Fira Sans Extra Condensed\"'>age group</span><br>and by whether the TBI was <span style=';font-family:\"Fira Sans Extra Condensed\"'>lethal or non-lethal</span>."),
       caption = "Data from www.cdc.gov/traumaticbraininjury/data\nRecreate this graphic at nsgrantham.com/traumatic-brain-injury\n*Cases of Intentional Self-harm among children under the age of 15 were not recorded and may not necessarily be zero",
       x = "Age group", y = NULL) +
  theme_minimal(base_family = "Fira Sans Extra Condensed Light", base_size = 18) +
  theme(
    plot.title = element_text(family = "Fira Sans Extra Condensed", size = 24, color = text_color),
    plot.subtitle = element_markdown(color = text_color, lineheight = 1.2),
    plot.caption = element_text(color = text_color, size = 14),
    plot.title.position = "plot",
    plot.caption.position = "plot",
    plot.background = element_rect(fill = background_color, color = background_color),
    plot.margin = margin(1.5, 1.5, 1, 1.5, unit = "line"),
    panel.grid.major.y = element_blank(),
    panel.grid.minor.y = element_blank(),
    panel.grid.major.x = element_blank(),
    strip.text = element_text(color = text_color, size = 16),
    axis.title = element_text(color = text_color),
    axis.text.x = element_text(color = text_color, hjust = -1.6, vjust = 5),
    axis.text.y = element_blank()
  )

ggsave("traumatic-brain-injury.png", width = 12, height = 8)

Unintentional falls are a common cause of TBIs, most of which are non-lethal but become more lethal as one ages. Intentional self-harm is, regrettably, another major cause of lethal TBIs, along with motor vehicle crashes, and, to a lesser degree, assault. Being unintentionally struck by an object may send you to the emergency room, but it is unlikely to kill you.