40.9 One-Table Summary

A pragmatic approach for business audiences: show descriptives and key regression side-by-side (or sequentially) in a single, coherent section. This can be achieved with gtsummary::tbl_merge() combining tbl_summary() and tbl_regression().

if (requireNamespace("gtsummary", quietly = TRUE) &&
    requireNamespace("gt", quietly = TRUE)) {
  library(gtsummary)
  library(gt)
  mod_for_tbl <- lm(metascore ~ log1p(budget) + log1p(us_gross) + runtime + year, data = movies_small)

  tbl1 <- movies_small %>%
    mutate(across(c(budget, us_gross), log1p)) %>%
    select(metascore, budget, us_gross, runtime, year) %>%
    tbl_summary(
      statistic = all_continuous() ~ "{mean} ({sd})",
      digits = all_continuous() ~ 1
    ) %>%
    bold_labels()

  tbl2 <- tbl_regression(mod_for_tbl, exponentiate = FALSE) %>%
    add_glance_table(include = c(r.squared, adj.r.squared, AIC, BIC), label = list(r.squared ~ "R^2",
                                                                                   adj.r.squared ~ "Adj. R^2"))

  tbl_merge(
    tbls = list(tbl1, tbl2),
    tab_spanner = c("**Descriptive Statistics**", "**Regression Results**")
  ) %>%
    as_gt() %>%
    tab_source_note(source_note = md("SEs are HC3-robust unless otherwise noted."))
}
Characteristic
Descriptive Statistics
Regression Results
N = 8311 Beta 95% CI p-value
metascore 63.0 (16.9)


budget 17.4 (1.2)


us_gross 17.9 (1.4)


runtime 1.9 (0.4) 14 11, 18 <0.001
year 2,002.2 (9.0) -0.01 -0.14, 0.12 0.8
log1p(budget)
-6.7 -7.9, -5.5 <0.001
log1p(us_gross)
3.8 2.7, 4.9 <0.001
R^2
0.169

Adj. R^2
0.165

AIC
6,915

BIC
6,943

1 Mean (SD)
Abbreviation: CI = Confidence Interval
SEs are HC3-robust unless otherwise noted.