-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
add_variable_grouping is a great addition to gtsummary. I hope it will move into the main package soon.
I found that the order of the variables for the grouping need to match the order in the original input table.
The problem was not immediately obvious to me, so maybe add a warning if it is not an easy fix.
library(bstfun)
set.seed(11234)
data.frame(
race_asian = sample(c(TRUE, FALSE), 20, replace = TRUE),
race_black = sample(c(TRUE, FALSE), 20, replace = TRUE),
race_white = sample(c(TRUE, FALSE), 20, replace = TRUE),
age = rnorm(20, mean = 50, sd = 10)
) %>%
gtsummary::tbl_summary(
label = list(race_asian = "Asian",
race_black = "Black",
race_white = "White",
age = "Age")
) %>%
add_variable_grouping(
"Race (check all that apply)" =
c(
"race_black",
"race_asian", # <--- Should be first
"race_white"
)
) |>
as_ggplot() # to show outputCreated on 2022-07-01 by the reprex package (v2.0.0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
