ez.corrmap: plot a correlation matrix map

View source: R/plot.R

ez.corrmapR Documentation

plot a correlation matrix map

Description

a wrapper of corrplot; the correlation and p values are calculated with rcorr, in which Missing values are deleted in pairs rather than deleting all rows of x having any missing variables

Usage

ez.corrmap(
  df,
  x = NULL,
  y = NULL,
  corr.type = "pearson",
  sig.level = 0.05,
  insig = "blank",
  type = "lower",
  method = "ellipse",
  tl.col = "black",
  tl.cex = 0.4,
  tl.pos = NULL,
  tl.srt = 45,
  addgrid.col = rgb(1, 1, 1, 0.01),
  addCoef.col = NULL,
  diag = FALSE,
  order = c("original", "AOE", "FPC", "hclust", "alphabet"),
  col = NULL,
  ...
)

Arguments

df

data frame in wide format, should be all numeric

x

cols in df, Both x y should be specified or be NULL. when specified, calculate correlation between cols x and cols y, get an asymmetric correlation matrix

y

cols in df

corr.type

"pearson" or "spearman", pairwise deletion for NA

sig.level

sig.level. make it 1 to essentially ignore param insig

insig

how to treat insig values, one of "pch"(show x, corrplot default),"p-value","blank", "n"(no change, as is)

type

Character, "full" (default), "upper" or "lower", display full matrix, lower triangular or upper triangular matrix.

method

"circle", "square", "ellipse", "number", "pie", "shade" and "color". The areas of circles or squares show the absolute value of corresponding correlation coefficients. "color" = same areas

tl.col

color of text label

tl.cex

size of text label (can still be increased to gain some margins for the map when tl.pos='n')

tl.pos

'n' for no text label. NULL=corrplot default=auto(??). Character or logical, position of text labels. If character, it must be one of "lt", "ld", "td", "d" or "n". "lt"(default if type=="full") means left and top, "ld"(default if type=="lower") means left and diagonal, "td"(default if type=="upper") means top and diagonal(near), "d" means diagonal, "n" means don't add textlabel.

tl.srt

Numeric, for text label string rotation in degrees.

addgrid.col

grid color. The color of the grid. If NA, don't add grid. If NULL the default value is chosen. The default value depends on method, if method is color or shade, the color of the grid is NA, that is, not draw grid; otherwise "grey".

addCoef.col

Color of coefficients added on the graph (eg, 'black'). If NULL (default), add no coefficients.

diag

Logical, whether display the correlation coefficients on the principal diagonal

order

"original" for original order (default).
"AOE" for the angular order of the eigenvectors.
"FPC" for the first principal component order.
"hclust" for the hierarchical clustering order.
"alphabet" for alphabetical order.

col

Vector, the color of glyphs. NULL=corrplot default. Jerry auto generates a default one if NULL.

...

see corrplot for more parameters

Value

returns a list (r, p) r: a matrix representing the corrmap (p > sig.level, set to NA/blank), p: all raw p values


jerryzhujian9/zmisc documentation built on March 9, 2024, 12:49 a.m.