rarefy_table: Rarefy OTU table to a specificied sample depth

Description Usage Examples

Description

This function takes an OTU counts table as input returns a subsampled table. The default input is samples as rows (Margin=1), but samples can be set to columns by setting Margin to 2. The rarified table is a multinomial sample with probabilities set to observed counts witihn each sample. The depth is set by user, often is the min observed depth (i.e. min(rowSums(otu_table))).

Usage

1
rarefy_table(x, depth = 1000, Margin = 1)

Examples

1
2
3
4
5
6
7
8
## example otu table with samples as rows
otu_tab1 <- matrix(
c(2, 4, 3, 1, 5, 7),
nrow=2, ncol=3)
rownames(otu_tab1) <- c("sample1","sample2")
colnames(otu_tab1) <- c("otu1","otu2","otu3")

rarefy_table(otu_tab1)

cjschulz/micromixR documentation built on May 13, 2019, 7:32 p.m.