Dataset summary with summarizor

Required packages

library(flextable)
use_df_printer()

The CO2 dataset

The example use datasets::CO2.

CO2[-1]

The summarizor object

The object returned by summarizor() is an data.frame restructured so that it can be used as input by tabulator().

obj <- summarizor(CO2[-1], by = "Treatment", overall_label = "Overall")
obj

The flextable

Let’s now create a cross-table of this summary by calling as_flextable().

ft <- as_flextable(obj, spread_first_col = TRUE, separate_with = "variable")
ft