View source: R/old_taxa--taxmap--s3.R
mutate_obs | R Documentation |
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(data, ...) mutate_obs(obj, data, ...)
obj |
An object of type [taxmap()] |
data |
Dataset name, index, or a logical vector that indicates which dataset in 'obj$data' to add columns to. |
... |
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. |
An object of type [taxmap()]
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()
# Add column to existing tables
mutate_obs(ex_taxmap, "info",
new_col = "Im new",
newer_col = paste0(new_col, "er!"))
# Create columns in a new table
mutate_obs(ex_taxmap, "new_table",
nums = 1:10,
squared = nums ^ 2)
# Add a new vector
mutate_obs(ex_taxmap, "new_vector", 1:10)
# Add a new list
mutate_obs(ex_taxmap, "new_list", list(1, 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.