corr_matrix: Create Correlation Matrix from corrp Inferences

View source: R/corr_matrix.R

corr_matrixR Documentation

Create Correlation Matrix from corrp Inferences

Description

Using the results obtained from the corrp function, this function creates a correlation matrix.

Usage

corr_matrix(c, ...)

## Default S3 method:
corr_matrix(c, col = c("infer.value", "stat.value", "isig"), isig = TRUE, ...)

## S3 method for class 'clist'
corr_matrix(c, col = c("infer.value", "stat.value", "isig"), isig = TRUE, ...)

Arguments

c

[clist]
Output from the corrp function.

...

Not used. Included for S3 method consistency.

col

[character(1)]
Specifies the column to be used in the correlation matrix.

isig

[logical(1)]
Determines whether values that are not statistically significant should be represented by NA or FALSE in the correlation matrix.

Value

[cmatrix]
A square matrix with class "cmatrix" where each cell [i,j] contains the correlation value between variables i and j. The correlation values are taken from the specified column (infer.value, stat.value, or isig) of the input clist. When isig=TRUE, only statistically significant correlations are included, others are set to NA.

Author(s)

Igor D.S. Siciliani, Paulo H. dos Santos

Examples


iris_cor <- corrp(iris)
iris_m <- corr_matrix(iris_cor, isig = FALSE)
if (require("corrplot")) {
  corrplot(iris_m) # You can visualize the matrix using corrplot
}

meantrix/corrP documentation built on June 12, 2025, 5:33 p.m.