subset: Subset an rbiom object by sample names or metadata.

subsetR Documentation

Subset an rbiom object by sample names or metadata.

Description

Subset an rbiom object by sample names or metadata.

Usage

## S3 method for class 'rbiom'
subset(biom, ..., clone = TRUE)

## S3 method for class 'rbiom'
biom[i]

Arguments

biom

An rbiom object, such as from as_rbiom().

...

Passed on to base::subset().

clone

Create a copy of biom before modifying. If FALSE, biom is modified in place as a side-effect. See speed ups for use cases. Default: TRUE

Value

An rbiom object.

See Also

Other transformations: mutate(), rarefy(), rarefy_cols(), slice()

Examples

    library(rbiom) 
    
    # Subset to specific samples
    biom <- hmp50[c('HMP20', 'HMP42', 'HMP12')]
    biom$metadata
    
    # Subset according to metadata (using base::subset)
    biom <- subset(hmp50, `Body Site` %in% c('Saliva') & Age < 25)
    biom$metadata


cmmr/rbiom documentation built on Feb. 16, 2024, 3:34 a.m.