APA Correlation Table (Blank or Filled)

Description

Creates a correlation matrix table that can be either filled with computed values (answer KEY) or blank (student worksheet). Supports a KEY toggle and can produce empty templates.

Usage

create_apa_corr_table(
  data = NULL,
  vars = NULL,
  var_labels = NULL,
  KEY = TRUE,
  table_title = "Means, Standard Deviations, and Correlations"
)

Arguments

data A data frame or NULL (for blank table when KEY = FALSE).
vars Character vector or NULL. Variable names to include.
var_labels Character vector or NULL. Display labels for variables. If NULL, labels are auto-generated.
KEY Logical. If TRUE and data/vars are provided, compute and fill values. If FALSE, create blank template.
table_title Character. Table caption text.

Value

A flextable::flextable() object.

Examples

library("psych350lab")

data(superman, package = "psych350data")

# Filled answer KEY table
ft_KEY <- create_apa_corr_table(
  data = superman,
  vars = c("clark_height_in", "rt_critics_score", "rt_audience_score"),
  var_labels = c("1. Clark Height", "2. Critics Score", "3. Audience Score"),
  KEY = TRUE
)
ft_KEY

Descriptive Statistics

Correlations

Variable

M

SD

n

1

2

1. Clark Height

73.37

1.68

11

2. Critics Score

79.38

10.53

8

0.03

3. Audience Score

80.22

9.86

9

-0.10

0.60

Note. *p < .05. **p < .01. ***p < .001.

# Blank student worksheet table
ft_blank <- create_apa_corr_table(
  var_labels = c("1. Clark Height", "2. Critics Score", "3. Audience Score"),
  KEY = FALSE
)
ft_blank

Descriptive Statistics

Correlations

Variable

M

SD

n

1

2

1. Clark Height

2. Critics Score

3. Audience Score

Note. *p < .05. **p < .01. ***p < .001.