我正在尝试用
_
替换 gtsummary 回归表中的 Ref
。我的旧代码不能像以前那样工作。我将不胜感激的帮助......
library(gtsummary)
mod1 <- glm(response ~ trt + age + grade, trial, family = binomial)
t1 <- tbl_regression(mod1, exponentiate = TRUE)
# This code would do the trick but does not currently does not. Using `gtsummary_2.0.3`
t1 |>
modify_table_styling(
rows = reference_row %in% TRUE,
missing_symbol = "Ref"
)
看起来您需要使用
modify_table_styling(columns)
参数指定要应用此更改的列。下面的例子!
library(gtsummary)
mod1 <- glm(response ~ trt + age + grade, trial, family = binomial)
t1 <- tbl_regression(mod1, exponentiate = TRUE)
# This code would do the trick but does not currently does not. Using `gtsummary_2.0.3`
t1 |>
modify_table_styling(
columns = c(estimate, conf.low),
rows = reference_row %in% TRUE,
missing_symbol = "Ref"
) |>
bold_labels() |>
as_kable() # convert to kable to display on SO
特点 | 或 | 95% CI | p 值 |
---|---|---|---|
化疗治疗 | |||
药物A | 参考 | 参考 | |
药物B | 1.13 | 0.60, 2.13 | 0.7 |
年龄 | 1.02 | 1.00, 1.04 | 0.10 |
等级 | |||
我 | 参考 | 参考 | |
二 | 0.85 | 0.39、1.85 | 0.7 |
III | 1.01 | 0.47, 2.15 | >0.9 |
创建于 2024-11-09,使用 reprex v2.1.1