library(tidyverse)
library(reprex)
y <-c('A','B','C','A')
x <-c('male','male','female',NA)
df <- as.data.frame(cbind(x,y))
reprex()
tbl_summary(df)
I want to add 100% next to N=4. How can I do that?
If your headings are always going to sum to 100%, then you could try modifying the header to add '(100%)' manually:
tbl_summary(df) %>%
modify_header(update = "stat_0" ~ "N = {n} (100%)")
For other scenarios, the modify_header()
function in gtsummary
should be able to do what you want.