Learn R Programming

rbiom (version 2.1.2)

adiv_table: Calculate the alpha diversity of each sample.

Description

Calculate the alpha diversity of each sample.

Usage

adiv_table(
  biom,
  adiv = "Shannon",
  md = ".all",
  transform = "none",
  cpus = NULL
)

Value

A data frame of alpha diversity values. Each combination of sample/depth/adiv has its own row. Column names are .sample, .depth, .adiv, and .diversity, followed by any metadata fields requested by md.

Arguments

biom

An rbiom object, such as from as_rbiom(). Any value accepted by as_rbiom() can also be given here.

adiv

Alpha diversity metric(s) to use. Options are: "OTUs", "Shannon", "Chao1", "Simpson", and/or "InvSimpson". Set adiv=".all" to use all metrics. Multiple/abbreviated values allowed. Default: "Shannon"

md

Dataset field(s) to include in the output data frame, or '.all' to include all metadata fields. Default: '.all'

transform

Transformation to apply. Options are: c("none", "rank", "log", "log1p", "sqrt", "percent"). "rank" is useful for correcting for non-normally distributions before applying regression statistics. Default: "none"

cpus

The number of CPUs to use. Set to NULL to use all available, or to 1 to disable parallel processing. Default: NULL

See Also

Other alpha_diversity: adiv_boxplot(), adiv_corrplot(), adiv_stats()

Examples

Run this code
    library(rbiom) 
    
    # Subset to 10 samples.
    biom <- slice(hmp50, 1:10)
    adiv_table(biom)
    
    biom <- rarefy(biom)
    adiv_table(biom, md = NULL)

Run the code above in your browser using DataLab