phyloseq (version 1.16.2)

subset_taxa: Subset species by taxonomic expression

Description

This is a convenience wrapper around the subset function. It is intended to speed subsetting complex experimental objects with one function call. In the case of subset_taxa, the subsetting will be based on an expression related to the columns and values within the tax_table (taxonomyTable component) slot of physeq. The OTUs retained in the dataset is equivalent to x[subset & !is.na(subset)], where x is the vector of OTU IDs and subset is the logical that results from your subsetting expression. This is important to keep in mind, as users are often unaware that this subsetting step also removes/omits OTUs that have a missing value result, NA, somewhere in the expression.

Usage

subset_taxa(physeq, ...)

Arguments

physeq
A taxonomyTable-class, or phyloseq-class that contains a taxonomyTable. If the tax_table slot is missing in physeq, then physeq will be returned as-is and a warning will be printed to screen.
...
The subsetting expression that should be applied to the taxonomyTable. This is passed on to subset, and more details and examples about how it functions can be found in its documentation.

Value

  • A subsetted object with the same class as physeq.

See Also

subset_samples

Examples

Run this code
## ex3 <- subset_taxa(GlobalPatterns, Phylum=="Bacteroidetes")

Run the code above in your browser using DataCamp Workspace