correlation: Correlation

Description Usage Arguments Value Note See Also Examples

Description

Correlation

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
correlation(x, y, ...)

## S4 method for signature 'numeric,numeric'
correlation(x, y, method = c("pearson", "kendall", "spearman"))

## S4 method for signature 'matrix,missingOrNULL'
correlation(x, y = NULL, method = c("pearson", "kendall", "spearman"))

## S4 method for signature 'matrix,matrix'
correlation(x, y, method = c("pearson", "kendall", "spearman"))

## S4 method for signature 'Matrix,missingOrNULL'
correlation(x, y = NULL, method = c("pearson", "kendall", "spearman"))

## S4 method for signature 'Matrix,Matrix'
correlation(x, y, method = c("pearson", "kendall", "spearman"))

## S4 method for signature 'SummarizedExperiment,missingOrNULL'
correlation(
  x,
  y = NULL,
  i = 1L,
  j = NULL,
  method = c("pearson", "kendall", "spearman")
)

## S4 method for signature 'SummarizedExperiment,SummarizedExperiment'
correlation(x, y, i = 1L, method = c("pearson", "kendall", "spearman"))

Arguments

x

Object.

y

Object.

method

a character string indicating which correlation coefficient (or covariance) is to be computed. One of "pearson" (default), "kendall", or "spearman": can be abbreviated.

i

integer(1) or character(1). For SummarizedExperiment, primary assay.

j

integer(1), character(1), or NULL. For SummarizedExperiment, optional secondary assay. If NULL, calculates correlation matrix only on the primary assay.

...

Additional arguments.

Value

numeric(1) or matrix.

Note

Updated 2020-01-20.

See Also

Examples

 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
data(correlation, package = "acidtest")
list <- correlation

## vector ====
x <- list[["vector_x"]]
y <- list[["vector_y"]]

head(x)
head(y)

correlation(x = x, y = y)

## matrix ====
x <- list[["matrix_x"]]
y <- list[["matrix_y"]]

head(x)
head(y)

stats::cor(x)
correlation(x)

stats::cor(x = c(x), y = c(y))
correlation(x = x, y = y)

## SummarizedExperiment ====
x <- list[["SummarizedExperiment_x"]]
y <- list[["SummarizedExperiment_y"]]

correlation(x = x, i = 1L)
correlation(x = x, i = 1L, j = 2L)
correlation(x = x, y = y)

acidgenomics/basejump documentation built on Aug. 15, 2020, 10:21 a.m.