Correlation

correlation(x, y, ...)

# S4 method for DESeqResults,DESeqResults
correlation(
  x,
  y,
  col = "log2FoldChange",
  method = c("pearson", "kendall", "spearman")
)

# S4 method for DESeqAnalysis,missingOrNULL
correlation(
  x,
  y = NULL,
  i,
  j,
  col = "log2FoldChange",
  method = c("pearson", "kendall", "spearman")
)

Arguments

x

Object.

y

Object.

col

character(1). Column name.

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 2019-12-18.

See also

Examples

## Working example currently only has 1 contrast slotted. data(deseq) ## DESeqResults ==== x <- results(deseq, i = 1L, lfcShrink = FALSE)
#> condition_B_vs_A (unshrunken LFC)
y <- results(deseq, i = 2L, lfcShrink = FALSE)
#> treatment_D_vs_C (unshrunken LFC)
correlation(x = x, y = y)
#> → Calculating pearson correlation on 499 values.
#> [1] 0.2520642
## DESeqAnalysis ==== x <- deseq correlation(x = x, i = 1L, j = 2L)
#> condition_B_vs_A (unshrunken LFC)
#> treatment_D_vs_C (unshrunken LFC)
#> → Calculating pearson correlation on 499 values.
#> [1] 0.2520642