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, ...)

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.

Value

An object of type taxmap()

See also

Examples

# Replace columns in a table with new columns transmute_obs(ex_taxmap, "info", new_col = paste0(name, "!!!"))
#> <Taxmap> #> 17 taxa: b. Mammalia, c. Plantae ... q. lycopersicum, r. tuberosum #> 17 edges: NA->b, NA->c, b->d, b->e ... j->o, k->p, l->q, l->r #> 4 data sets: #> info: #> # A tibble: 6 x 2 #> taxon_id new_col #> <chr> <chr> #> 1 m tiger!!! #> 2 n cat!!! #> 3 o mole!!! #> # … with 3 more rows #> phylopic_ids: a named vector of 'character' with 6 items #> m. e148eabb-f138-43[truncated] ... r. 63604565-0406-46[truncated] #> foods: a list of 6 items named by taxa: #> m, n, o, p, q, r #> abund: #> # A tibble: 8 x 5 #> taxon_id code sample_id count taxon_index #> <chr> <fct> <fct> <dbl> <int> #> 1 m T A 1 1 #> 2 n C A 2 2 #> 3 o M B 5 3 #> # … with 5 more rows #> 1 functions: #> reaction