with: Evaluate expressions on metadata.

withR Documentation

Evaluate expressions on metadata.

Description

with() will return the result of your expression. within() will return an rbiom object.

Usage

## S3 method for class 'rbiom'
with(data, expr, ...)

## S3 method for class 'rbiom'
within(data, expr, clone = TRUE, ...)

Arguments

data

An rbiom object, such as from as_rbiom().

expr

Passed on to base::with() or base::within().

...

Not used.

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

See description.

See Also

Other transformations: modify_metadata, rarefy(), rarefy_cols(), slice_metadata, subset()

Examples

    library(rbiom) 
    
    with(hmp50, table(`Body Site`, Sex))
    
    biom <- within(hmp50, {
      age_bin = cut(Age, 5)
      bmi_bin = cut(BMI, 5)
    })
    biom$metadata


rbiom documentation built on April 3, 2025, 6:39 p.m.