cor_matrix: Calculates correlation matrix with significance tests and...

View source: R/cor_tables.R

cor_matrixR Documentation

Calculates correlation matrix with significance tests and descriptives

Description

Calculates the correlation matrix between the numeric variables in a given dataframe and includes descriptives (mean and standard deviation) - ready for creating a nice table with apa_cor_table

Usage

cor_matrix(
  x,
  var_names = NULL,
  method = c("pearson", "spearman", "kendall"),
  adjust = "none",
  ...
)

Arguments

x

Dataframe of variables that can be coerced to numeric.

var_names

A named character vector with the names that should be displayed for variables. If NULL, then the variables are not renamed. If names are provided, only the variables included in this vector are retained.

method

method="pearson" is the default value. The alternatives to be passed to cor are "spearman" and "kendall"

adjust

What adjustment for multiple tests should be used? ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"). See p.adjust for details about why to use "holm" rather than "bonferroni").

...

Arguments passed on to psych::corr.test

use

use="pairwise" is the default value and will do pairwise deletion of cases. use="complete" will select just complete cases.

alpha

alpha level of confidence intervals

Value

A list including the correlation matrix, p-values, standard errors, t-values, pairwise number of observations, confidence intervals and descriptives

Source

Adapted from http://www.sthda.com/english/wiki/elegant-correlation-table-using-xtable-r-package


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