
Last chance! 50% off unlimited learning
Sale ends in
Creates a named vector that maps the values of two variables associated with taxa in a [taxonomy()] or [taxmap()] object. Both values must be named by taxon ids.
obj$map_data(from, to, warn = TRUE)
map_data(obj, from, to, warn = TRUE)
A vector of `to` values named by values in `from`.
The [taxonomy()] or [taxmap()] object.
The value used to name the output. There will be one output value for each value in `from`. Any variable that appears in [all_names()] can be used as if it was a variable on its own.
The value returned in the output. Any variable that appears in [all_names()] can be used as if it was a variable on its own.
If `TRUE`, issue a warning if there are multiple unique values of `to` for each value of `from`.
Other taxonomy data functions:
classifications()
,
id_classifications()
,
is_branch()
,
is_internode()
,
is_leaf()
,
is_root()
,
is_stem()
,
map_data_()
,
n_leaves()
,
n_leaves_1()
,
n_subtaxa()
,
n_subtaxa_1()
,
n_supertaxa()
,
n_supertaxa_1()
,
taxon_ids()
,
taxon_indexes()
,
taxon_names()
,
taxon_ranks()
# Mapping between two variables in `all_names(ex_taxmap)`
map_data(ex_taxmap, from = taxon_names, to = n_legs > 0)
# Mapping with external variables
x = c("d" = "looks like a cat", "h" = "big scary cats",
"i" = "smaller cats", "m" = "might eat you", "n" = "Meow! (Feed me!)")
map_data(ex_taxmap, from = taxon_names, to = x)
Run the code above in your browser using DataLab