alpha.div: Estimate the diversity of each sample.

Description Usage Arguments Value Examples

View source: R/alpha.div.r

Description

Estimate the diversity of each sample.

Usage

1
alpha.div(biom, rarefy = FALSE, progressbar = NULL)

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).

progressbar

An object of class Progress.

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
    library(rbiom)
    
    infile <- system.file("extdata", "hmp50.biom", 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")

cmmr/rbiom documentation built on Nov. 21, 2018, 10:04 a.m.