And*_*a M 6 r footnotes gtsummary gt
我正在尝试向gtsummary表格的行标签添加脚注,但我不知道如何引用我想要的确切单元格。
预期输出
\n使用默认trial数据集,我想在“Drug B”中添加一个脚注,内容为“ie placebo”:
| 特征 | N = 200\xc2\xb9 |
|---|---|
| 化疗治疗 | |
| __ 药物A | 98 (49%) |
| __ 药物 B \xc2\xb2 | 102 (51%) |
| \xc2\xb9 n (%) | |
| \xc2\xb2 即安慰剂 |
我尝试转换为gt表格,然后使用tab_footnote()and cells_stub(),但我不知道如何使用row = 来引用我想要的特定行标签。
不幸的是,文档示例cells_stub()仅使用其默认locations = everything()参数值。
library(gtsummary)\nlibrary(gt)\n\ntrial["trt"] |>\n tbl_summary() |>\n as_gt() |>\n tab_footnote(footnote = "i.e. placebo",\n # Line below doesn\'t work\n locations = cells_stub(rows = "Drug B"))\nRun Code Online (Sandbox Code Playgroud)\n
Dan*_*erg 10
您可以使用该gtsummary::modify_table_styling()功能在表格正文中放置脚注。下面举例!
library(gtsummary)
tbl <-
trial |>
select(trt) |>
tbl_summary() |>
modify_table_styling(
columns = label,
rows = label == "Drug B",
footnote = "i.e. placebo"
)
Run Code Online (Sandbox Code Playgroud)
由reprex 包(v2.0.1)于 2022-07-28 创建
| 归档时间: |
|
| 查看次数: |
2766 次 |
| 最近记录: |