有人知道是否有可能从汇总表(tbl_summary()
和add_p()
)中排除一些p值吗?
还可以更改所用测试的脚注吗?
library(gtsummary)
mtcars %>%
tbl_summary(by = am) %>%
add_p()
答案 0 :(得分:2)
这些是很棒的自定义问题,答案是肯定的!
首先,可以将include =
函数的add_p()
参数与要包含(或排除使用-
)的变量的字符向量一起使用,也可以将任何{ {3}}(即starts_with()
),以选择要在表格中包含哪些p值。
接下来,我提供了一个使用{gt}包中的参数的示例,说明如何修改默认脚注列表测试。可以在c/c++ ffmpeg-libav-tutorial中看到另一个示例。
祝您好运,希望对您有帮助!
library(gtsummary)
library(dplyr, warn.conflicts = F)
library(gt)
trial %>%
select(trt, stage, age, grade) %>%
tbl_summary(by = trt) %>%
add_p(
include = c(-age) #Can use any tidyselect helpers/select syntax to specify which p-vals
) %>%
as_gt(include = -tab_footnote) %>% # if using gt, can exclude footnotes this way
tab_footnote( # and can modify/add footnotes this way
footnote = "Tests used are...",
locations = cells_column_labels(columns = vars(p.value))
)
答案 1 :(得分:1)