I wanted to include the results of one-tailed t-test using gt_summary. Is there a way to do this?
CodePudding user response:
You can pass arguments to t.test()
via the add_p(test.args=)
argument. In your case, you'll want to pass the t.test(alternative = "less")
(or "greater"
) argument. Example below!
library(gtsummary)
tbl <-
trial %>%
select(age, marker, trt) %>%
tbl_summary(by = trt, missing = "no") %>%
add_p(
all_continuous() ~ "t.test",
test.args = all_tests("t.test") ~ list(alternative = "less")
)
Created on 2021-10-10 by the reprex package (v2.0.1)