Hmisc::rcorr in the backend.Creates a publication-ready / formatted correlation matrix, using Hmisc::rcorr in the backend.
correlation_matrix(
df,
type = "pearson",
digits = 3,
decimal.mark = ".",
use = "all",
show_significance = TRUE,
replace_diagonal = FALSE,
replacement = ""
)a correlation matrix
dataframe; containing numeric and/or logical columns to calculate correlations for
character; specifies the type of correlations to compute; gets passed to Hmisc::rcorr; options are "pearson" or "spearman"; defaults to "pearson"
integer/double; number of decimals to show in the correlation matrix; gets passed to formatC; defaults to 3
character; which decimal.mark to use; gets passed to formatC; defaults to .
character; which part of the correlation matrix to display; options are "all", "upper", "lower"; defaults to "all"
boolean; whether to add * to represent the significance levels for the correlations; defaults to TRUE
boolean; whether to replace the correlations on the diagonal; defaults to FALSE
character; what to replace the diagonal and/or upper/lower triangles with; defaults to "" (empty string)
correlation_matrix(iris)
correlation_matrix(mtcars)
Run the code above in your browser using DataLab