Learn R Programming

rbiom (version 2.2.0)

modify_metadata: 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 rbiom
mutate(.data, ..., clone = TRUE)

# S3 method for rbiom rename(.data, ..., clone = TRUE)

Value

An rbiom object.

Arguments

.data

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

See Also

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

Examples

Run this code
    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

Run the code above in your browser using DataLab