taxa.prevalence: get prevalence (presence in number of samples) for each taxon

View source: R/taxa_prevalence.R

taxa.prevalenceR Documentation

get prevalence (presence in number of samples) for each taxon

Description

This function uses the abundance table in a 'phyloseq' object to determine how many samples a given taxon (OTU/ASV) occurs in and returns either a named vector or a 'data.table' with the results

Usage

taxa.prevalence(
  physeq,
  sorted = c("from.table", "by.taxon", "decreasing", "increasing"),
  return.table = FALSE
)

Arguments

physeq

a phyloseq object with an 'otu_table'

sorted

character; how do you want the results sorted? "from.table" returns the results in the same order as the column names in the 'otu_table'. "by.taxon returns the results sorted alphanumerically by taxon name. "decreasing" returns the results sorted by abundance, highest to lowest. "increasing" returns the results sorted by abundance, lowest to highest. Default is "from.table".

return.table

logical; if TRUE, returns a 2-column 'data.table' with results. If FALSE, returns a named vector

See Also

phyloseq, otu_table, otu.matrix, data.table

Examples

data(example_phyloseq)
head(sort(taxa.prevalence(example_phyloseq), decreasing = TRUE))

kstagaman/phyloseqCompanion documentation built on Aug. 26, 2022, 5:07 a.m.