Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using gtsummary and have stacked tables for the outputs of 11 different models on top of one another using the tbl_regression and tbl_stack functions. I am looking to see how the odds ratios of one consistent independent variable change across different dependent variables of interest. When I print out the tbl_stack output, it gives me 11 repeated rows of the independent variable name of interest, instead of the name of the unique dependent variables I am interested in. Does anyone know how to rename rows in tbl_stack (either manually or automatically) to put the dependent variable names in the rows?

Thank you.

question from:https://stackoverflow.com/questions/65649545/renaming-rows-in-gtsummary-tbl-regression-tbl-stack

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
852 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can use the tbl_regression(label=) argument to change the labels for the repeating variable to match the outcome for each model before you stack them.

There is, however, a shortcut using tbl_uvregerssion().

library(gtsummary)
packageVersion("gtsummary")
#> '1.3.6'

trial %>%
  select(response, death, age) %>%
  tbl_uvregression(
    x = age, 
    method = glm,
    method.args = list(family = binomial),
    exponentiate = TRUE
  ) %>%
  modify_header(label ~ "**Outcome**")

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...