correlation_matrix {corrtable}R Documentation

Creates a publication-ready / formatted correlation matrix, using Hmisc::rcorr in the backend.

Description

Creates a publication-ready / formatted correlation matrix, using Hmisc::rcorr in the backend.

Usage

correlation_matrix(
  df,
  type = "pearson",
  digits = 3,
  decimal.mark = ".",
  use = "all",
  show_significance = TRUE,
  replace_diagonal = FALSE,
  replacement = ""
)

Arguments

df

dataframe; containing numeric and/or logical columns to calculate correlations for

type

character; specifies the type of correlations to compute; gets passed to Hmisc::rcorr; options are "pearson" or "spearman"; defaults to "pearson"

digits

integer/double; number of decimals to show in the correlation matrix; gets passed to formatC; defaults to 3

decimal.mark

character; which decimal.mark to use; gets passed to formatC; defaults to .

use

character; which part of the correlation matrix to display; options are "all", "upper", "lower"; defaults to "all"

show_significance

boolean; whether to add * to represent the significance levels for the correlations; defaults to TRUE

replace_diagonal

boolean; whether to replace the correlations on the diagonal; defaults to FALSE

replacement

character; what to replace the diagonal and/or upper/lower triangles with; defaults to "" (empty string)

Value

a correlation matrix

Examples

correlation_matrix(iris)
correlation_matrix(mtcars)

[Package corrtable version 0.1.1 Index]