descendants: Get ids of descendants of some taxa

View source: R/taxo.R

descendantsR Documentation

Get ids of descendants of some taxa

Description

Get ids of descendants of some taxa

Usage

descendants(taxon_ids, taxo, n = Inf)

Arguments

taxon_ids

internal, numeric ids of the taxa.

taxo

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

n

maximum number of levels to look down; n=1 gives the direct children, n=2 gives children and grand-children, etc.

Details

Even with n=1, the function is different from children() because it returns all unique children for all elements of taxon_ids, not one vector of children per element.

Value

A vector of taxonomic ids containing the input taxon_ids and all their descendants.

See Also

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

Examples

print(as.Node(taxo), "id")
descendants(3, taxo)
descendants(1, taxo)
descendants(c(2,5), taxo)
descendants(7, taxo)
descendants(NA, taxo)
descendants(1, taxo, n=1)
descendants(1, taxo, n=2)
descendants(1, taxo, n=3)
descendants(1, taxo, n=10)
# NB:
descendants(5:6, taxo, n=1)
children(5:6, taxo)

jiho/ecotaxar documentation built on Jan. 16, 2024, 12:26 a.m.