Get the full lineage of a taxon

lineage(taxon_ids, taxo, rooted = FALSE)

Arguments

taxon_ids

internal, numeric ids of the taxa.

taxo

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

rooted

when TRUE, add a root (#) to the lineage path.

Value

A vector of strings containing the lineage for each element of taxon_ids.

See also

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

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
lineage(6, taxo)
#> [1] "living/mollusc/squid"
lineage(6, taxo, rooted=TRUE)
#> [1] "/#/living/mollusc/squid"
lineage(c(6, 7), taxo)
#> [1] "living/mollusc/squid" "living/mollusc/snail/egg"
lineage(NA, taxo)
#> [1] NA
lineage(c(6, NA), taxo)
#> [1] "living/mollusc/squid" NA