Hi technocrat,
Thanks for the reply.
I tried to increase the number of observations, doesn't seem to solve the problem. What's the minimum number of observations required for each group? Or am I misunderstanding the problem?
test <- data.frame("Gender" = c("Female", "Male", "Female", "Male", "Male", "Male", "Female", "Female", "Female"),
"vegetable_score" = c(1.2, 5.5, 2.7, 1.2, 2.5, 3.6, 4.7, 5.8, 1.3))
test %>%
tbl_summary(
by = Gender,
statistic = list(all_continuous() ~ "{mean} ({sd})")) %>%
modify_header(label ~ "Variable") %>%
modify_spanning_header(c("stat_1", "stat_2") ~ "Gender") %>%
add_overall() %>%
add_n()