fcor: Fast correlation and mutual rank analysis

View source: R/functions.R

fcorR Documentation

Fast correlation and mutual rank analysis

Description

This function calculates Pearson/Spearman correlations between all pairs of features in a matrix/dataframe much faster than the base R cor function. It is also possible to simultaneously calculate mutual rank (MR) of correlations as well as their p-values and adjusted p-values. Additionally, this function can automatically combine and flatten the result matrices. Selecting correlated features using an MR-based threshold rather than based on their correlation coefficients or an arbitrary p-value is more efficient and accurate in inferring functional associations in systems, for example in gene regulatory networks.

Usage

fcor(
  data,
  use = "everything",
  method = "spearman",
  mutualRank = TRUE,
  pvalue = FALSE,
  adjust = "BH",
  flat = TRUE
)

Arguments

data

A numeric dataframe/matrix (features on columns and samples on rows).

use

The NA handler, as in R's cov() and cor() functions. Options are "everything", "all.obs", and "complete.obs".

method

a character string indicating which correlation coefficient is to be computed. One of "pearson" or "spearman" (default).

mutualRank

logical, whether to calculate mutual ranks of correlations or not.

pvalue

logical, whether to calculate p-values of correlations or not.

adjust

p-value correction method (when pvalue = TRUE), a character string including any of "BH" (default), "bonferroni", holm", "hochberg", "hommel", or "none".

flat

logical, whether to combine and flatten the result matrices or not.

Value

Depending on the input data, a dataframe or list including cor (correlation coefficients), mr (mutual ranks of correlation coefficients), p (p-values of correlation coefficients), and p.adj (adjusted p-values).

See Also

pcor, p.adjust, and graph_from_data_frame

Examples

## Not run: 
set.seed(1234)
data <- datasets::attitude
cor <- fcor(data = data)

## End(Not run)

influential documentation built on Aug. 6, 2022, 9:05 a.m.