FoldChange: FoldChange

Description Usage Arguments Details Value Author(s)

View source: R/aveytoolkit_FoldChange.R

Description

Calculate the fold change between pairs of conditions in a matrix or data frame

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
FoldChange(
  x,
  condNum,
  condDen,
  conditions,
  grouping,
  preserveOrder = FALSE,
  log2Transform = FALSE,
  oper = c("subtract", "divide")
)

Arguments

x

matrix or data.frame from which to calculate fold changes with samples in columns.

condNum

a vector of condition(s) to be used as the numerator in the fold change calculation

condDen

a vector of condition(s) to be used as the denominator in the fold change calculation

conditions

a vector with length equal to the number of columns of x containing the condition labels between which to find the fold changes.

grouping

a vector with length equal to the number of columns of x containing a grouping of the samples (e.g. subjects, cell lines, strains).

preserveOrder

if TRUE, the same ordering of the columns in x will be kept after columns in condDen are removed. If FALSE (the default for backwards compatability), the ordering is changed to sort by group, then by condNum in order passed in.

log2Transform

when 'TRUE', log2 transformation will be applied to x before taking the FC. If 'FALSE' (default) no transformation is applied and x is ASSUMED to be already log transformed.

oper

the operation to be performed between numerator and denominator. Default is 'subtract' because this is appropriate for log-transformed data. Set oper to 'divide' if data is on linear scale.

Details

FoldChange takes the fold change of log2 transformed data by subtracting columns of the x dataframe or matrix depending on the conditions passed in.

Value

a data.frame of the fold changes with one column for each fold change

Author(s)

Stefan Avey


stefanavey/aveytoolkit documentation built on March 5, 2020, 12:49 a.m.