descendants.Rd
Get ids of descendants of some taxa
descendants(taxon_ids, taxo, n = Inf)
taxon_ids | internal, numeric ids of the taxa. |
---|---|
taxo | a taxonomy data.frame, typically from |
n | maximum number of levels to look down; n=1 gives the direct children, n=2 gives children and grand-children, etc. |
A vector of taxonomic ids containing the input taxon_ids
and all their descendants.
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.
Other taxonomy-related functions:
ancestors()
,
as.taxo()
,
children()
,
extract_taxo()
,
is_leaf()
,
lineage()
,
parent()
,
taxo_id()
,
taxo_name()
#> levelName id #> 1 # NA #> 2 °--living 1 #> 3 ¦--fish 2 #> 4 ¦ °--egg 4 #> 5 °--mollusc 3 #> 6 ¦--snail 5 #> 7 ¦ °--egg 7 #> 8 °--squid 6descendants(3, taxo)#> [1] 3 5 6 7descendants(1, taxo)#> [1] 1 2 3 4 5 6 7#> [1] 2 5 4 7descendants(7, taxo)#> [1] 7descendants(NA, taxo)#> [1] NAdescendants(1, taxo, n=1)#> [1] 1 2 3descendants(1, taxo, n=2)#> [1] 1 2 3 4 5 6descendants(1, taxo, n=3)#> [1] 1 2 3 4 5 6 7descendants(1, taxo, n=10)#> [1] 1 2 3 4 5 6 7# NB: descendants(5:6, taxo, n=1)#> [1] 5 6 7#> [[1]] #> [1] 7 #> #> [[2]] #> numeric(0) #>