cor_by_grp: Correlation test in each group

View source: R/cor_by_grp.R

cor_by_grpR Documentation

Correlation test in each group

Description

Two-sided correlation test in each group and combine the directional p-values.

Usage

cor_by_grp(
  object,
  phenotype,
  grp,
  method = "pearson",
  reorder.rows = TRUE,
  prefix = NULL,
  check.names = TRUE
)

Arguments

object

Matrix-like data object containing log-ratios or log-expression values, with rows corresponding to features (e.g. genes) and columns to samples. Must have row names that are non-duplicated and non-empty.

phenotype

Numeric vector of sample characteristics (e.g. phenotypes or treatments). Should be same length as ncol(object).

grp

Vector of sample groups. These must be valid variable names in R and the same length as ncol(object).

method

Character string indicating which correlation coefficient to be used for the test. One of "pearson", "kendall", or "spearman", can be abbreviated, see cor.test.

reorder.rows

Logical, should rows be reordered by p-value?

prefix

Character string to add to beginning of column names. NULL does not add a prefix.

check.names

Logical; should names(phenotype)==rownames(object) be checked?

Value

A data.frame of test statistics for each group and the combined statistics.


jdreyf/jdcbioinfo documentation built on April 15, 2024, 6:37 p.m.