Skip to contents

Descriptive statistics for a set of variables

Usage

summary_statistics_table(
  data,
  variables = NULL,
  stats = c("n", "mean", "sd", "median", "min", "max", "missing"),
  digits = 2L,
  output_format = "dataframe",
  title = "Summary Statistics"
)

Arguments

data

Data frame.

variables

Variable names (auto-detect numeric if NULL).

stats

Vector of statistic names.

digits

Decimal places.

output_format

Output target.

title

Title.

Value

A character string.

Examples

set.seed(1)
df <- data.frame(age = rnorm(50, 40, 10), score = rnorm(50))
summary_statistics_table(df)
#>        n  mean   sd median   min   max missing
#> age   50 41.00 8.31  41.29 17.85 55.95       0
#> score 50  0.12 0.97   0.11 -1.80  2.40       0