簡體   English   中英

向 gtsummary 表中的單行 label 添加腳注

[英]Adding a footnote to a single row label in a gtsummary table

我正在嘗試在gtsummary表的 label 行中添加腳注,但我不知道如何引用我想要的確切單元格。

預期 output

使用默認trial數據集,我想在“葯物 B”中添加一個腳注,內容為“即安慰劑”:

特征 N = 200¹
化療治療
__ 葯物 A 98 (49%)
__ 葯物 B ² 102 (51%)
¹ n (%)
² 即安慰劑

我嘗試轉換為gt表,然后使用tab_footnote()cells_stub() ,但我不知道如何使用row =來引用我想要的特定行 label 。

不幸的是, cells_stub()的文檔示例僅使用其默認locations = everything()參數值。

library(gtsummary)
library(gt)

trial["trt"] |>
        tbl_summary() |>
        as_gt() |>
        tab_footnote(footnote = "i.e. placebo",
                     # Line below doesn't work
                     locations = cells_stub(rows = "Drug B"))

您可以使用gtsummary::modify_table_styling() function 在表格正文中放置腳注。 下面的例子

library(gtsummary)

tbl <-
  trial |>
  select(trt) |> 
  tbl_summary() |>
  modify_table_styling(
    columns = label,
    rows = label == "Drug B",
    footnote = "i.e. placebo"
  )

在此處輸入圖像描述 代表 package (v2.0.1) 於 2022 年 7 月 28 日創建

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM