What is the correct syntax to display both median and mean of a continuous variable using tbl_continuous? Also, is it possible to display on 2 lines as you can do with tbl_summary and the continuous2 argument?
Code below is just displaying medians (see image).
comparison.data %>%
select(imaging, los.minutes, acuity) %>%
tbl_continuous(
by = imaging,
variable = los.minutes,
statistic =
los.minutes ~ c("{mean} ({sd})",
"{median} ({sd})")
) %>%
modify_spanning_header(all_stat_cols() ~ "**Imaging status**")
Example below!
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.6.1'
tbl <-
trial %>%
tbl_continuous(
variable = age,
by = trt,
include = grade,
statistic = ~"{mean} \n{median}"
) %>%
as_gt() %>%
gt::fmt_markdown(columns = everything())
Created on 2022-08-24 by the reprex package (v2.0.1)