fortify_cor: Convert to cor_tbl based on input type.convert

Description Usage Arguments Value Author(s) See Also Examples

View source: R/fortify-cor.R

Description

The fortify_cor function is a deep encapsulation of the as_cor_tbl function and also supports converting raw data into cor_tbl objects by calculation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
fortify_cor(
  x,
  y = NULL,
  is.cor = FALSE,
  group = NULL,
  type = "full",
  show.diag = TRUE,
  cor.test = FALSE,
  cluster = FALSE,
  cluster.method = "complete",
  ...
)

Arguments

x

any R object.

y

NULL (default) or a matrix or data frame with compatible dimensions to x.

is.cor

logical value (default to FALSE) indicating wheater x is a correlation matrix.

group

NULL (default) or a vector that has the same number of rows as x.

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.

cor.test

logical value (default to TRUE) indicating whether test for the correlation.

cluster

logical value (default to FALSE) indicating whether reorder the correlation matrix by cluster.

cluster.method

the agglomeration method to be used. This should be (an unambiguous abbreviation of) one of "ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC).

...

extra params passing to matrix_order.

Value

cor_tbl object.

Author(s)

Houyun Huang, Lei Zhou, Jian Chen, Taiyun Wei

See Also

matrix_order, hclust, as_cor_tbl.

Examples

1
2
3
4
5
fortify_cor(mtcars)
fortify_cor(iris[-5], group = iris[[5]])
fortify_cor(mtcars, type = "lower", cluster = TRUE)
m <- cor(mtcars)
fortify_cor(m, is.cor = TRUE)

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