Format correlation results for fill-in-the-blank output

Description

Creates a markdown-formatted results section for correlation analysis, with either filled answers (KEY=TRUE) or blanks for student worksheets.

Usage

format_corr_results(
  rh_name,
  vars,
  corr_results_list,
  Key = TRUE,
  digits = 2,
  p_digits = 3
)

Arguments

rh_name Name/number of research hypothesis (e.g., "RH1").
vars Character vector of two variable names.
corr_results_list A results list from corr_answers().
Key If TRUE, show answers; if FALSE, show blanks.
digits Number of decimal places for statistics (default 2).
p_digits Number of decimal places for p-values (default 3).

Value

Character string of formatted results (markdown).

Examples

library("psych350lab")

result <- corr_answers(data, "var1", "var2")
cat(format_corr_results("RH1", c("var1", "var2"), result, Key = TRUE))