Learn R Programming

metacoder (version 0.3.7)

transmute_obs: Replace columns in [taxmap()] objects

Description

Replace columns of tables in `obj$data` in [taxmap()] objects. See [dplyr::transmute()] for the inspiration for this function and more information. Calling the function using the `obj$transmute_obs(...)` style edits "obj" in place, unlike most R functions. However, calling the function using the `transmute_obs(obj, ...)` imitates R's traditional copy-on-modify semantics, so "obj" would not be changed; instead a changed version would be returned, like most R functions.


obj$transmute_obs(data, ...)
transmute_obs(obj, data, ...)

Value

An object of type [taxmap()]

Arguments

obj

An object of type [taxmap()]

data

Dataset name, index, or a logical vector that indicates which dataset in `obj$data` to use.

...

One or more named columns to add. Newly created columns can be referenced in the same function call. Any variable name that appears in [all_names()] can be used as if it was a vector on its own.

target

DEPRECIATED. use "data" instead.

See Also

Other taxmap manipulation functions: arrange_obs(), arrange_taxa(), filter_obs(), filter_taxa(), mutate_obs(), sample_frac_obs(), sample_frac_taxa(), sample_n_obs(), sample_n_taxa(), select_obs()

Examples

Run this code
# Replace columns in a table with new columns
transmute_obs(ex_taxmap, "info", new_col = paste0(name, "!!!"))

Run the code above in your browser using DataLab