crosstable_options(crosstable_fontsize_header=14,
crosstable_fontsize_subheaders=10,
crosstable_fontsize_body=8)
crosstable(iris) %>% as_flextable()
crosstable(mtcars2, -model, by=c(am, vs)) %>% as_flextable(header_show_n=1)
crosstable(mtcars2, cols=c(mpg, cyl), by=am, effect=TRUE) %>%
as_flextable(keep_id=TRUE, autofit=FALSE)
crosstable(mtcars2, cols=c(mpg, cyl), by=am, effect=TRUE, total=TRUE) %>%
as_flextable(compact=TRUE, header_show_n=TRUE,
header_show_n_pattern=list(cell="{.col} (N={.n})", total="Total\n(N={.n})"))
#Renaming (because why not?)
crosstable(mtcars2, am, by=vs, total="both", test=TRUE, effect=TRUE) %>%
dplyr::rename(ID=.id, math=variable, Tot=Total, lab=label, pval=test, fx=effect) %>%
as_flextable(by_header = "Engine shape",
generic_labels=list(id = "ID", variable = "math", total="Tot",
label = "lab", test = "pval", effect="fx"))
Run the code above in your browser using DataLab