79274744

Date: 2024-12-12 10:38:10
Score: 0.5
Natty:
Report link

Are you after modify_header()?

library(dplyr)
library(gtsummary)
library(ggplot2)

mpg %>%
  select(manufacturer, drv) %>%
  tbl_summary(by = drv,
              digits=list(all_categorical() ~ c(function(x){round(x/5) * 5}, 0)),
              type = list(displ = "continuous2")) %>%
  modify_header(all_stat_cols() ~ "**{level}** \n\n **N = {round(n/5)*5}**")

Gives:

enter image description here

(output truncated)

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-2):
Posted by: Edward