library("psych350lab")
data(superman, package = "psych350data")
my_data <- superman[!is.na(superman$height_diff),
c("clark_height_in", "height_diff", "clark_grp", "height_gap")]
stats <- univariate_stats_answers(my_data)
# Without SEM (default)
create_apa_univariates_table(
data = my_data,
continuous = c("clark_height_in", "height_diff"),
categorical = c("clark_grp", "height_gap"),
stats_data = stats
)
# With SEM column
create_apa_univariates_table(
data = my_data,
continuous = c("clark_height_in", "height_diff"),
categorical = c("clark_grp", "height_gap"),
stats_data = stats,
show_sem = TRUE
)
# Blank worksheet
create_apa_univariates_table(
data = my_data,
continuous = c("clark_height_in", "height_diff"),
categorical = c("clark_grp", "height_gap"),
KEY = FALSE
)APA Univariate Statistics Table
Description
Creates an APA-formatted univariate statistics table suitable for univariate descriptives, ANOVA group descriptives, and regression sample descriptions. Continuous variables show M(SD) and n; categorical variables show level frequencies and percentages. Produces either a filled answer KEY or a blank student worksheet.
Usage
create_apa_univariates_table(
data = NULL,
continuous = NULL,
categorical = NULL,
stats_data = NULL,
var_labels = NULL,
show_sem = FALSE,
KEY = TRUE,
table_title = NULL,
footnote = NULL,
digits = 2
)
create_apa_descriptives_table(...)
Arguments
data
|
A data frame. Required when KEY = TRUE and categorical variables are included. Can be NULL for continuous-only tables.
|
continuous
|
Character vector or NULL. Continuous variable names. These display as M(SD) with n.
|
categorical
|
Character vector or NULL. Categorical variable names. These display level labels with n and percentage.
|
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”).
|
show_sem
|
Logical. If TRUE, adds a SEM column for continuous variables. Default FALSE.
|
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, extended with SEM if show_sem = TRUE.
|
digits
|
Integer. Decimal places for M, SD, and SEM. Default 2. |
…
|
Arguments passed to create_apa_univariates_table().
|
Value
A flextable::flextable() object.