Learn R Programming

countdata (version 1.3)

fold.change: Fold change calculation

Description

Calculates the fold changes between two numerical matrices row by row.

Usage

fold.change(d1, d2, BIG = 1e4)

Value

A vector of fold changes is returned.

Arguments

d1

The first data matrix.

d2

The second data matrix.

BIG

A number representing a big value of the result, i.e. black-and-white regulation.

Author

Thang V. Pham

Details

The two matrices d1 and d2 must have the same number of rows. A positive value means up-regulation where the average of d2 is higher than that of d1. Conversely, a negative value means down-regulation where the the average of d1 is higher than that of d2. If one group contains all zeros, a positive or negative BIG value is returned.

References

Pham TV (2021). countdata: The Beta-Binomial Test for Count Data. R package version 1.1. https://CRAN.R-project.org/package=countdata

Examples

Run this code
x <- rbind(c(1.5, 1.2, 10.2),
           c(9.1, 2.2, 8.1))

fold.change(x, 2 * x)
# returns a column vector of 2

fold.change(x, 0.5 * x)
# returns a column vector of -2

Run the code above in your browser using DataLab