APA Descriptive Statistics Table

Description

Creates an APA-formatted descriptive statistics table. Continuous variables show M(SD) and n; categorical variables show level frequencies and percentages. Produces either a filled answer KEY or blank student worksheet.

Usage

create_descriptive_table(
  data = NULL,
  show_sem = NULL,
  continuous = NULL,
  categorical = NULL,
  stats_data = NULL,
  var_labels = NULL,
  KEY = TRUE,
  table_title = NULL,
  footnote = NULL,
  digits = 2
)

Arguments

data A data frame. Required when KEY = TRUE.
show_sem Logical or NULL. If TRUE, adds a SEM column for continuous variables. Default NULL (no SEM column).
continuous Character vector or NULL. Continuous variable names.
categorical Character vector or NULL. Categorical variable names.
stats_data Output from univariate_stats_answers(). Required when KEY = TRUE.
var_labels Named character vector or NULL. Display labels, e.g. c(height_diff = “Height Difference”).
KEY Logical. If TRUE (default), fill with computed values. If FALSE, create a blank worksheet template.
table_title Character or NULL. Optional caption.
footnote Character or NULL. Footer note. Defaults to APA-style M/SD/N explanation.
digits Integer. Decimal places for M and SD. Default 2.

Value

A flextable object.