Renaming Rows in gtsummary, tbl_regression/tbl_stack

半世苍凉 提交于 2021-02-10 14:33:01

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!