alpha.div: Estimate the diversity of each sample.

Description Usage Arguments Value Examples

Description

Estimate the diversity of each sample.

Usage

1

Arguments

biom

A matrix, simple_triplet_matrix, or BIOM object, as returned from read.biom. For matrices, the rows and columns are assumed to be the taxa and samples, respectively.

rarefy

Control how/whether rarefactions are done prior to alpha diversity computations. Options are:

FALSE

Use each sample's current set of observations without applying any rarefaction. (Default)

TRUE

Automatically select and apply a single rarefaction.

"multi"

Automatically select and apply multiple rarefactions.

integer vector

Rarefy at the specified depth(s).

Value

A data frame of four diversity values for each sample in biom. The column names are Sample, Depth and the diversity metrics: OTUs, Shannon, Chao1, Simpson, and InvSimpson. The row names are the sample names, except when multiple rarefactions are done.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    library(rbiom)
    
    infile <- system.file("extdata", "hmp50.bz2", package = "rbiom")
    biom <- read.biom(infile)
    
    ad <- alpha.div(biom)
    head(ad)
    
    biom <- subset(biom, `Body Site` == "Saliva" & Age < 26)
    ad   <- alpha.div(biom, "multi")
    boxplot(Shannon ~ Depth, data=ad, xlab="Reads", ylab="Diversity")
    

rbiom documentation built on July 2, 2020, 1:47 a.m.