I am using gtsummary package to generate summary tables.
I would like to do the following:
- That the "add_p" function performs a two-proportions z-test for the proportions in the "by" variable instead of chi-square test for independence. Using stats::prop.test
- Displays on the footnote that the "Statistical tests performed" are "2-sample test for equality of proportions with continuity correction"
How can I do that within this example code?
trial2 <- trial %>% select(trt, grade)
trial3 <- trial2[-which(trial2$grade == "III"),]
trial4 <- droplevels(trial3)
trial4 %>%
tbl_summary(
by = trt,
statistic = list(all_continuous() ~ "{mean} ({sd})",
all_categorical() ~ "{n} / {N} ({p}%)"),
digits = all_continuous() ~ 2,
label = grade ~ "Tumor Grade"
) %>% add_p()
Thank you!

