I have a table with variable names usually spelt with superscript or subscript numbers. I'm using R package {gtsummary} to automatically create the table from select columns of a data frame/tibble.
Say this is the tibble:
library(nycflights13)
lm_1 <- lm(arr_delay ~ air_time, flights)
tbl_1 <- tbl_regression(lm_1, exponentiate = F,
label = list(
air_time ~ "Air Time"
)) %>%
add_glance_source_note(include = c('r.squared'))
tbl_1
… but I need to write this as Airtime (HTML Air<sup>time</sup> or Markdown Air~time~).
In {gtsummary}, specifying the label argument in HTML or Markdown doesn't work for me:
tbl_1 <- tbl_regression(lm_1, exponentiate = F,
label = list(
air_time ~ "Air<sup>time</sup>",
sched_dep_time ~ "Departure^time^"
)) %>%
add_glance_source_note(include = c('r.squared'))
I've tried wrapping the strings in gt::html() or gt::md() but it didn't change anything:
tbl_1 <- tbl_regression(lm_1, exponentiate = F,
label = list(
air_time ~ html("Air<sup>time</sup>"),
sched_dep_time ~ md("Departure^time^")
)) %>%
add_glance_source_note(include = c('r.squared'))
Would it be possible to use HTML and/or Markdown in gtsummary tables? Thanks!

