Learn R Programming

rbiom (version 2.1.2)

taxa_table: Taxa abundances per sample.

Description

taxa_matrix() -

Accepts a single rank and returns a matrix.

taxa_table() -

Can accept more than one rank and returns a tibble data.frame.

Usage

taxa_table(
  biom,
  rank = -1,
  taxa = 6,
  lineage = FALSE,
  md = ".all",
  unc = "singly",
  other = FALSE,
  transform = "none",
  ties = "random",
  seed = 0
)

taxa_matrix( biom, rank = -1, taxa = NULL, lineage = FALSE, sparse = FALSE, unc = "singly", other = FALSE, transform = "none", ties = "random", seed = 0 )

Value

taxa_matrix() -

A numeric matrix with taxa as rows, and samples as columns.

taxa_table() -

A tibble data frame with column names .sample, .taxa, .abundance, and any requested by md.

Arguments

biom

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

rank

What rank(s) of taxa to display. E.g. "Phylum", "Genus", ".otu", etc. An integer vector can also be given, where 1 is the highest rank, 2 is the second highest, -1 is the lowest rank, -2 is the second lowest, and 0 is the OTU "rank". Run biom$ranks to see all options for a given rbiom object. Default: -1.

taxa

Which taxa to display. An integer value will show the top n most abundant taxa. A value 0 <= n < 1 will show any taxa with that mean abundance or greater (e.g. 0.1 implies >= 10%). A character vector of taxa names will show only those named taxa. Default: 6.

lineage

Include all ranks in the name of the taxa. For instance, setting to TRUE will produce Bacteria; Actinobacteria; Coriobacteriia; Coriobacteriales. Otherwise the taxa name will simply be Coriobacteriales. You want to set this to TRUE when unc = "asis" and you have taxa names (such as Incertae_Sedis) that map to multiple higher level ranks. Default: FALSE

md

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

unc

How to handle unclassified, uncultured, and similarly ambiguous taxa names. Options are:

"singly" -

Replaces them with the OTU name.

"grouped" -

Replaces them with a higher rank's name.

"drop" -

Excludes them from the result.

"asis" -

To not check/modify any taxa names.

Abbreviations are allowed. Default: "singly"

other

Sum all non-itemized taxa into an "Other" taxa. When FALSE, only returns taxa matched by the taxa argument. Specifying TRUE adds "Other" to the returned set. A string can also be given to imply TRUE, but with that value as the name to use instead of "Other". Default: FALSE

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"

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

sparse

If TRUE, returns a slam::simple_triplet_matrix(), otherwise returns a normal R matrix object. Default: FALSE

See Also

Other taxa_abundance: sample_sums(), taxa_boxplot(), taxa_clusters(), taxa_corrplot(), taxa_heatmap(), taxa_stacked(), taxa_stats(), taxa_sums()

Examples

Run this code
    library(rbiom)
    
    hmp50$ranks
    
    taxa_matrix(hmp50, 'Phylum')[1:4,1:6]
    
    taxa_table(hmp50, 'Phylum')

Run the code above in your browser using DataLab