Reputation: 11
I'm trying to use tbl_summary in R. I need to pass as input variable the list of columns to use in "add_p (include = ... )" Is there a way for do it ???
thanks in advance A
tmp=c(-age, -stage, -grade)
trial %>%
select(trt, stage, age, grade, response) %>%
tbl_summary(by = trt) %>%
add_p( include = tmp )
Upvotes: 1
Views: 131
Reputation: 124148
Using a vector of characters and any_of
or all_of
you could do:
library(gtsummary)
tmp <- c("age", "stage", "grade")
trial %>%
select(trt, stage, age, grade, response) %>%
tbl_summary(by = trt) %>%
add_p( include = !any_of(tmp) )
Upvotes: 2