I am using the gtsummary package to build a table of patient characteristics. I am having an issue using the selecting function all_dichotomous
. Some variables default to showing on one line, but I want them to all show on multiple lines.
This is the code I am using, but I am getting an error. Any suggestions? Thanks! This data set is in the package.
library(gtsummary)
trial %>%
tbl_summary(type = list(all_dichotomous = "categorical"))
You've almost got it! You'll want to use the formula notation in the list, rather than a named list. Like this:
library(gtsummary)
trial %>%
dplyr::select(response, age) %>%
tbl_summary(type = list(all_dichotomous() ~ "categorical"))
There are some examples here: http://www.danieldsjoberg.com/gtsummary/articles/tbl_summary.html#select_helpers