mutate: Create, modify, and delete metadata fields.

mutateR Documentation

Create, modify, and delete metadata fields.

Description

mutate() creates new fields in ⁠$metadata⁠ that are functions of existing metadata fields. It can also modify (if the name is the same as an existing field) and delete fields (by setting their value to NULL).

Usage

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

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

Arguments

biom

An rbiom object, such as from as_rbiom().

...

Passed on to dplyr::mutate() or dplyr::rename().

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: rarefy(), rarefy_cols(), slice(), subset(), with()

Examples

    library(rbiom) 
    
    biom <- slice_max(hmp50, BMI, n = 6)
    biom$metadata
    
    # Add a new field to the metadata
    biom <- mutate(biom, Obsese = BMI >= 30)
    biom$metadata
    
    # Rename a metadata field
    biom <- rename(biom, 'Age (years)' = "Age")
    biom$metadata


cmmr/rbiom documentation built on April 28, 2024, 6:38 a.m.