Learn R Programming

flextable (version 0.9.5)

summarizor: Data summary preparation

Description

It performs a univariate statistical analysis of a dataset by group and formats the results so that they can be used with the tabulator() function or directly with as_flextable.

summarizor illustration

Usage

summarizor(
  x,
  by = character(),
  overall_label = NULL,
  num_stats = c("mean_sd", "median_iqr", "range"),
  hide_null_na = TRUE
)

Arguments

x

dataset

by

columns names to be used as grouping columns

overall_label

label to use as overall label

num_stats

available statistics for numerical columns to show, available options are "mean_sd", "median_iqr" and "range".

hide_null_na

if TRUE (default), NA counts will not be shown when 0.

See Also

fmt_summarizor(), labelizor()

Examples

Run this code
# \dontshow{
data.table::setDTthreads(1)
# }
z <- summarizor(CO2[-c(1, 4)],
  by = "Treatment",
  overall_label = "Overall"
)
ft_1 <- as_flextable(z)
ft_1

ft_2 <- as_flextable(z, sep_w = 0, spread_first_col = TRUE)
ft_2

z <- summarizor(CO2[-c(1, 4)])
ft_3 <- as_flextable(z, sep_w = 0, spread_first_col = TRUE)
ft_3

Run the code above in your browser using DataLab