Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as_cor_mat

Convert a Correlation Test Data Frame into a Correlation Matrix


Description

Convert a correlation test data frame, returned by the cor_test(), into a correlation matrix format.

Usage

as_cor_mat(x)

Arguments

x

an object of class cor_test.

Value

Returns a data frame containing the matrix of the correlation coefficients. The output has an attribute named "pvalue", which contains the matrix of the correlation test p-values.

See Also

Examples

# Pairwise correlation tests between variables
#:::::::::::::::::::::::::::::::::::::::::::::::
res.cor.test <- mtcars %>%
  select(mpg, disp, hp, drat, wt, qsec) %>%
  cor_test()
res.cor.test

# Convert the correlation test into a correlation matrix
#:::::::::::::::::::::::::::::::::::::::::::::::
res.cor.test %>% as_cor_mat()

rstatix

Pipe-Friendly Framework for Basic Statistical Tests

v0.7.0
GPL-2
Authors
Alboukadel Kassambara [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.