If the top row of a header column is blank, you may experience printing issues when using knitr::kable

# S3 method for fmt_table1
modify_header(x, label = NULL, stat_by = NULL,
  stat_overall = NULL, pvalue = NULL, ...)

Arguments

x

fmt_table1 object

label

string vector including text to appear above the label column

stat_by

string vector of text to include above the summary statistics stratified by a variable. The following fields are available for use in the headers: n, N, p, name, and level. n is the number of observations in each by group. N is the total number of observations. p is the percentage of rows in a by group. name is the name of the by variable. level is the by variable level. Syntax follows the glue::glue() function, e.g. stat_by = c("{level}", "N = {n} ({p}\%)"). Must specify by along with stat_by.

stat_overall

string vector including text to appear above the overall summary statistics. N, the total number of observations, is available for use in the description.

pvalue

string vector including text to appear above the p-value column

...

further arguments passed to or from other methods

Examples

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