rquery_cormat: Correlation matrix

View source: R/requery_cormat.R

rquery_cormatR Documentation

Correlation matrix

Description

Calculate and easily visualize a correlation matrix. Function comes from Correlation matrix : An R function to do all you need

Usage

rquery_cormat(
  x,
  type = c("lower", "upper", "full", "flatten"),
  graph = TRUE,
  graphType = c("correlogram", "heatmap"),
  col = NULL,
  ...
)

Arguments

x

matrix of data values

type

Possible values are “lower” (default), “upper”, “full” or “flatten”. It displays the lower or upper triangular of the matrix, full or flatten matrix.

graph

if TRUE, a correlogram or heatmap is generated to visualize the correlation matrix.

graphType

Type of graphs. Possible values are “correlogram” or “heatmap”.

col

colors to use for the correlogram or the heatmap.

...

Further arguments to be passed to cor() or cor.test() function.

Value

A list containing the following:

r

table of correlation coefficients

p

Table of p-values corresponding to the significance levels of the correlations

sym

A representation of the correlation matrix in which coefficients are replaced by symbols according to the strength of the dependence

Examples

mydata <- mtcars[, c(1,3,4,5,6,7)]
head(mydata)

# Computing the correlation matrix
rquery_cormat(mydata)

# Upper triangle of the correlation matrix
rquery_cormat(mydata, type = "upper")

# Full correlation matrix
rquery_cormat(mydata, type = "full")

emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.