Skip to contents

Create a matrix of samples x alpha diversity metrics.

Usage

adiv_matrix(biom, transform = "none")

Arguments

biom

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

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"

Value

A numeric matrix with samples as rows and columns named Depth, OTUs, Shannon, Chao1, Simpson, and InvSimpson.

Examples

    library(rbiom)
    
    biom <- slice_head(hmp50, n = 5)
#> Warning:  Dropping 45 samples from biom object since they are not in the new metadata:
#>   "HMP06", "HMP07", "HMP08", "HMP09", "HMP10", "HMP11", "HMP12", "HMP13",
#>   "HMP14", "HMP15", "HMP16", "HMP17", "HMP18", "HMP19", "HMP20", "HMP21",
#>   "HMP22", "HMP23", …, "HMP49", and "HMP50".
    
    adiv_matrix(biom)
#>       Depth OTUs  Shannon     Chao1   Simpson InvSimpson
#> HMP01  1660   49 1.741153  59.08333 0.5668414   2.308623
#> HMP02  1371   75 2.587401 104.38889 0.8133914   5.358811
#> HMP03  1353   75 2.950982  90.04167 0.8936622   9.403996
#> HMP04  1895   83 3.255787  93.32143 0.9323645  14.785129
#> HMP05  3939   67 1.462651 127.75000 0.5252255   2.106263
#> attr(,"cmd")
#> [1] "adiv_matrix(biom)"