taxa (version 0.1.0)

mutate_obs: Add columns to taxmap() objects

Description

Add columns to tables in obj$data in taxmap() objects. See dplyr::mutate() for the inspiration for this function and more information. Calling the function using the obj$mutate_obs(...) style edits "obj" in place, unlike most R functions. However, calling the function using the mutate_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$mutate_obs(target, ...)
mutate_obs(obj, target, ...)

Arguments

obj

An object of type taxmap()

target

The name of the table in obj$data to filter

...

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.

Value

An object of type taxmap()

See Also

Other taxmap manipulation functions: arrange_obs, arrange_taxa, filter_obs, filter_taxa, sample_frac_obs, sample_frac_taxa, sample_n_obs, sample_n_taxa, select_obs, transmute_obs

Examples

Run this code
# NOT RUN {
mutate_obs(ex_taxmap, "info",
           new_col = "Im new",
           newer_col = paste0(new_col, "er!"))

# }

Run the code above in your browser using DataCamp Workspace