apa_cor_table: Create a correlation table with summary statistics in APA...

View source: R/cor_tables.R

apa_cor_tableR Documentation

Create a correlation table with summary statistics in APA style

Description

This function, creates (and optionally saves) a correlation table with summary statistics. It accepts correlation matrices from various functions in this package as its first argument

Usage

apa_cor_table(
  cor_matrix,
  ci = c("given", "z_transform", "simple_SE"),
  n = NULL,
  filename = NULL,
  notes = list(NULL),
  stars = NULL,
  add_title = FALSE,
  extras = NULL,
  apa_style = TRUE
)

Arguments

cor_matrix

A correlation matrix, for example returned from cor_matrix(), survey_cor_matrix(), or wtd_cor_matrix_mi()

ci

Method to create CI - default is to use any given in the cor_matrix, and otherwise to compute them using z-transformations. The simple SE method should not be used, but is provided for compatibility.

n

Number of observations to calculate confidence intervals - only needed if cor_matrix does not contain degrees of freedom (df) and confidence intervals are to be calulcated using z-transformations

filename

the file name to create on disk. Include '.html' extension to best preserve formatting (see gt::gtsave for details)

notes

List of additional notes to show under the table.

stars

A character vector to change the significance symbols (see details in 'sigstars')

add_title

Should title be added to table? Set to TRUE for default title or to character for custom title

extras

Tibble of additional columns to be added after the descriptives column - needs to be sorted in the same order as the 'desc' element in the cor_matrix

apa_style

Logical, should APA-style formatting be applied

Value

A table that can be printed in the RStudio console to be shown in the viewer. Unless it is to be post-processed with further 'gt' functions, it should usually be saved by passing a filename argument.

Source

Based on the apaTables apa.cor.table() function, but adapted to accept weighted correlation matrices and work with the 'gt' package instead. Code for calculation of confidence intervals adapted from https://medium.com/@shandou/how-to-compute-confidence-interval-for-pearsons-r-a-brief-guide-951445b9cb2d'


LukasWallrich/rNuggets documentation built on Aug. 26, 2022, 11:03 a.m.