DA.spe: Spearman's Rank Correlation

View source: R/DA.spe.R

DA.speR Documentation

Spearman's Rank Correlation

Description

Apply Spearman correlation to multiple features with one predictor

Usage

DA.spe(data, predictor, relative = TRUE, p.adj = "fdr", ...)

Arguments

data

Either a matrix with counts/abundances, OR a phyloseq object. If a matrix/data.frame is provided rows should be taxa/genes/proteins and columns samples

predictor

The predictor of interest. Either a Factor or Numeric, OR if data is a phyloseq object the name of the variable in sample_data(data) in quotation

relative

Logical. Should data be normalized to relative abundances. Default TRUE

p.adj

Character. P-value adjustment. Default "fdr". See p.adjust for details

...

Additional arguments for the cor.test function

Value

A data.frame with with results.

Examples

# Creating random count_table and predictor
set.seed(4)
mat <- matrix(rnbinom(1000, size = 0.1, mu = 500), nrow = 50, ncol = 20)
rownames(mat) <- 1:50
pred <- rnorm(20)

# Running Spearman correlation on each feature
res <- DA.spe(data = mat, predictor = pred)

Russel88/DAtest documentation built on March 24, 2022, 3:50 p.m.