Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

subset_samples-methods

Subset samples by sample_data expression


Description

This is a convenience wrapper around the subset function. It is intended to allow subsetting complex experimental objects with one function call. Subsetting is based on an expression for which the context first includes the variables contained in sample_data. The samples retained in the dataset is equivalent to x[subset & !is.na(subset)], where x is the vector of sample 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 samples that have a missing value, NA, somewhere in the expression.

Usage

subset_samples(physeq, ...)

Arguments

physeq

A sample_data-class, or a phyloseq-class object with a sample_data. If the sample_data 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 sample_data. This is passed on to subset, see its documentation for more details.

Value

A subsetted object with the same class as physeq.

See Also

Examples

# data(GlobalPatterns)
 # subset_samples(GlobalPatterns, SampleType=="Ocean")

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.