display_cor: Display correlation matrix with nice format

Description Usage Arguments Value Author(s) Examples

View source: R/display-cor.R

Description

Functions to display correlation object.

Format an correlation matrix for printing.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
display_cor(x, ...)

## S3 method for class 'matrix'
display_cor(x, ...)

## S3 method for class 'data.frame'
display_cor(x, ...)

## S3 method for class 'correlate'
display_cor(x, ...)

## S3 method for class 'rcorr'
display_cor(x, ...)

## S3 method for class 'corr.test'
display_cor(x, ...)

## S3 method for class 'cor_tbl'
display_cor(
  x,
  type = "full",
  show.diag = FALSE,
  digits = 2,
  nsmall = 2,
  sig.level = c(0.05, 0.01, 0.001),
  mark = c("*", "**", "***"),
  coef = NULL,
  nice.format = TRUE,
  ...
)

## S3 method for class 'mantel_tbl'
display_cor(x, byrow = TRUE, ...)

## S3 method for class 'pro_tbl'
display_cor(x, byrow = TRUE, ...)

format_cor(
  corr,
  p.value = NULL,
  type = "full",
  show.diag = FALSE,
  digits = 2,
  nsmall = 2,
  sig.level = c(0.05, 0.01, 0.001),
  mark = c("*", "**", "***"),
  nice.format = TRUE
)

Arguments

x

any R object.

...

extra params passing to format_cor.

type

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

show.diag

a logical value indicating whether keep the diagonal.

digits

integer indicating the number of decimal places (round) or significant digits (signif) to be used, the default value is 2.

nsmall

the minimum number of digits to the right of the decimal point in formatting real/complex numbers in non-scientific formats, the default value is 2.

sig.level

significance level,the defaults values is [0.05, 0.01, 0.001].

mark

significance mark,the defaults values is ["*", "**", "***"].

coef

string to specifies which column is the coefficient when "x" is a general_cor_tbl.

nice.format

a logical value indicating whether the output needs to be automatically optimized.

byrow

a logical value indicating whether arrange the 'spec' columns on y axis.

corr

a correlation matrix.

p.value

NULL (default) or a matrix of p value.

Value

a data frame.

Author(s)

Houyun Huang, Lei Zhou, Jian Chen, Taiyun Wei

Examples

1
2
3
corr <- correlate(mtcars, cor.test = TRUE)
format_cor(corr$r, corr$p.value, type = "lower")
display_cor(corr)

houyunhuang/ggcor documentation built on July 22, 2020, 8:31 p.m.