1

跟进问题(重命名 gtsummary 中的行,tbl_regression/tbl_stack):

我现在尝试将重命名的堆叠表(表 1)与包含每个结果的流行率的 tbl_summary 表(表 2)合并。然而,因为表 1 的每一行重命名实际上都是一遍又一遍地重复的同一个变量,所以它不会与表 2 合并,而是创建一个(表 3),其中重复的结果名称堆叠在一起。有什么方法可以合并这些表,使表 1 的行与表 2 的行无缝匹配?

4

1 回答 1

0

更新:从 gtsummary v 1.4.0 开始,tbl_uvregression()现在接受调查对象。

library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.4.0'

# convert trial data frame to survey object
tbl <- 
  survey::svydesign(
    data = trial[c("response", "death", "age", "marker")], 
    ids = ~1, 
    weights = ~1
  ) %>%
  # build univariate regression models
  tbl_uvregression(
    x = age, 
    method = survey::svyglm,
    method.args = list(family = binomial),
    exponentiate = TRUE,
    formula = "{y} ~ {x} + marker",
    label = list(response = "Response", death = "Death"),
    hide_n = TRUE,
    include = -marker
  ) %>%
  add_n() %>%
  add_nevent() %>%
  modify_header(
    label = "**Outcome**",
    estimate = "**Age OR**"
  )

在此处输入图像描述 reprex 包于 2021-04-14 创建 (v2.0.0 )

于 2021-01-11T21:21:12.300 回答