有没有一种方法可以向 gtsummary 表添加脚注,该脚注在与另一个表合并后仍然保留?

发布于 2025-01-20 00:51:20 字数 631 浏览 3 评论 0原文

我有两个桌子“ 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吻风 2025-01-27 00:51:20

您使用的是all_stat_cols(),该旨在与tbl_summary()对象一起使用,而不是tbl_regression()表。使用show_header_names()函数以打印列名,以便能够将脚注放在所需的列上,例如modify_footnote(估算〜“赔率比”)>

You are using all_stat_cols(), which is intended for use with tbl_summary() objects, rather than tbl_regression() tables. Use the show_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")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文