The function assumes the DEFAULT header are in use. Only modify header rows after all columns has been added.

add_n(x, missing = FALSE, last = FALSE)

Arguments

x

object with class fmt_table1 from the fmt_table1 function

missing

logical argument indicating whether to print N (missing = FALSE), or N missing (missing = TRUE). Default is FALSE

last

logical indicator to include overall column last. Default is FALSE

Examples

trial %>% fmt_table1(by = "trt") %>% add_n()
#> #> Variable N Drug Placebo #> N = 107 N = 93 #> Age, yrs 192 47 (39, 58) 46 (36, 54) #> Unknown 3 5 #> Marker Level, ng/mL 192 0.61 (0.22, 1.20) 0.72 (0.22, 1.63) #> Unknown 4 4 #> T Stage 200 #> T1 25 (23%) 26 (28%) #> T2 26 (24%) 23 (25%) #> T3 29 (27%) 13 (14%) #> T4 27 (25%) 31 (33%) #> Grade 200 #> I 38 (36%) 29 (31%) #> II 34 (32%) 24 (26%) #> III 35 (33%) 40 (43%) #> Tumor Response 191 52 (51%) 30 (33%) #> Unknown 6 3