问题
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.
回答1:
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**")
来源:https://stackoverflow.com/questions/65649545/renaming-rows-in-gtsummary-tbl-regression-tbl-stack