Hi,
This might be a silly question. I am trying to use tbl_summary to create a summary table for my data. But somehow the results for numeric variables are reported as categoricals. I don't know why this happened. Below is the code I used.
test <- data.frame("Gender" = c("Female", "Male", "Female", "Female"),
"vegetable_score" = c(1.214138, 5.552633, 2.757568, 1.209925))
test %>%
tbl_summary(
by = Gender,
type = all_continuous() ~ "continuous",
statistic = list(all_continuous() ~ "{mean} ({sd})")) %>%
modify_header(label ~ "Variable") %>%
modify_spanning_header(c("stat_1", "stat_2") ~ "Gender")
Anyone can shed some lights? Thanks.
Polly