有没有一种方法可以向 gtsummary 表添加脚注,该脚注在与另一个表合并后仍然保留?
我有两个桌子“ TBL”。我想在最后的合并表中添加脚注,但这对我不起作用。 我已经尝试将其添加到单个表中:
library(gtsummary)
packageVersion("gtsummary")
tbl <-
glm(response ~ grade, trial, family = binomial) %>%
tbl_regression(exponentiate = TRUE) %>%
add_glance_table(include = nobs) %>%
add_n(location = c("label", "level")) %>%
modify_footnote(all_stat_cols() ~ "models")
它适用于单个表,但是一旦我合并了它们,脚注就会消失。
我已经尝试将其添加到合并的表格中,但是没有成功:
tbl_final <-
tbl_merge(list(tbl, tbl), tab_spanner = c("**Men**", "**Women**")) %>%
modify_footnote(all_stat_cols() ~ "Models")
我应该如何处理? 谢谢!
I have two tables 'tbl' that I have merged. I want to add a footnote to the final merged table, but it doesn't work for me.
I've tried both adding it to the individual tables like so:
library(gtsummary)
packageVersion("gtsummary")
tbl <-
glm(response ~ grade, trial, family = binomial) %>%
tbl_regression(exponentiate = TRUE) %>%
add_glance_table(include = nobs) %>%
add_n(location = c("label", "level")) %>%
modify_footnote(all_stat_cols() ~ "models")
And it works for the individual tables, but as soon as I merge them the footnote disappears.
I've tried adding it to the merged table like so, but without success:
tbl_final <-
tbl_merge(list(tbl, tbl), tab_spanner = c("**Men**", "**Women**")) %>%
modify_footnote(all_stat_cols() ~ "Models")
How should I go about it?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的是
all_stat_cols()
,该旨在与tbl_summary()
对象一起使用,而不是tbl_regression()
表。使用show_header_names()
函数以打印列名,以便能够将脚注放在所需的列上,例如modify_footnote(估算〜“赔率比”)
>You are using
all_stat_cols()
, which is intended for use withtbl_summary()
objects, rather thantbl_regression()
tables. Use theshow_header_names()
function to print the column names to be able to place the footnotes on the columns you need, e.g.modify_footnote(estimate ~ "Odds Ratio")