Learn R Programming

rbiom (version 3.1.0)

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",
  tree = NULL,
  transform = "none",
  ties = "random",
  seed = 0,
  cpus = n_cpus()
)

adiv_matrix( biom, adiv = c("observed", "shannon", "simpson"), tree = NULL, transform = "none", ties = "random", seed = 0, cpus = n_cpus() )

adiv_vector( biom, adiv = "shannon", tree = NULL, transform = "none", ties = "random", seed = 0, cpus = n_cpus() )

Value

adiv_vector() -

A named numeric vector.

adiv_matrix() -

A matrix of samples x metric. The first column, 'depth', is never transformed.

adiv_table() -

A tibble data.frame of alpha diversity values. Each combination of sample/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, or any value accepted by as_rbiom().

adiv

Alpha diversity metric(s) to use. Options are: c("ace", "berger", "brillouin", "chao1", "faith", "fisher", "simpson", "inv_simpson", "margalef", "mcintosh", "menhinick", "observed", "shannon", "squares"). For "faith", a phylogenetic tree must be present in biom or explicitly provided via tree=. 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'

tree

A phylo object representing the phylogenetic relationships of the taxa in biom. Only required when computing UniFrac distances. Default: biom$tree

transform

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

ties

When transform="rank", how to rank identical values. Options are: c("average", "first", "last", "random", "max", "min"). See rank() for details. Default: "random"

seed

Random seed for permutations. Must be a non-negative integer. Default: 0

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

sample_sums() for sample depths.

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

Examples

Run this code
    library(rbiom)
    
    biom <- hmp50[1:5]
    
    adiv_table(biom)
    
    biom <- rarefy(biom)
    adiv_table(biom, md = NULL)
    
    adiv_vector(biom, 'faith')
    
    adiv_matrix(biom)

Run the code above in your browser using DataLab