Skip to content

Feature request: Inherit tab_spanner from name of list of tables #2359

@szimmer

Description

@szimmer

Is your feature request related to a problem? Please describe.
A named list is useful in making sure things are in order. It could be nice that when using tbl_merge() that the tab_spanner defaults to those names.

Describe the solution you'd like

library(survival)
library(gtsummary)
t1 <-
  glm(response ~ trt + grade + age, trial, family = binomial) %>%
  tbl_regression(exponentiate = TRUE)
t2 <-
  coxph(Surv(ttdeath, death) ~ trt + grade + age, trial) %>%
  tbl_regression(exponentiate = TRUE)

table_list <- list("**Tumor Response**"=t1, "**Time to Death**"=t2)

tbl_merge(
  tbls = table_list,
  tab_spanner = names(table_list)
)

This is what it would look like but you wouldn't need to explicitly specify the names. I would find this useful for something like this:

tbl_merge(
  tbls = list("**Tumor Response**"=t1, "**Time to Death**"=t2)
)

Additional context
This ensures the ordering is correct and is a slick default if names are present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions