Get the names of taxa from their ids

taxo_name(taxon_ids, taxo, unique = FALSE)

Arguments

taxon_ids

internal, numeric ids of the taxa.

taxo

a taxonomy data.frame, typically from extract_taxo().

unique

force names to be unique by adding the parent name when needed.

Value

A vector names, one for each element of taxon_ids.

See also

Other taxonomy-related functions: ancestors(), as.taxo(), children(), descendants(), extract_taxo(), is_leaf(), lineage(), parent(), taxo_id()

Examples

print(as.Node(taxo), "id")
#> levelName id #> 1 # NA #> 2 °--living 1 #> 3 ¦--fish 2 #> 4 ¦ °--egg 4 #> 5 °--mollusc 3 #> 6 ¦--snail 5 #> 7 ¦ °--egg 7 #> 8 °--squid 6
taxo_name(5, taxo)
#> [1] "snail"
taxo_name(2:7, taxo)
#> [1] "fish" "mollusc" "egg" "snail" "squid" "egg"
taxo_name(2:7, taxo, unique=TRUE)
#> [1] "fish" "mollusc" "egg<fish" "snail" "squid" "egg<snail"