Return the stem taxa for a taxonomy() or a taxmap() object. Stem taxa are all those from the roots to the first taxon with more than one subtaxon.

obj$stems(subset = NULL, simplify = FALSE,
  value = "taxon_indexes", exclude_leaves = FALSE)
stems(obj, subset = NULL, simplify = FALSE,
  value = "taxon_indexes", exclude_leaves = FALSE)

Arguments

obj

The taxonomy() or taxmap() object containing taxon information to be queried.

subset

Taxon IDs, TRUE/FALSE vector, or taxon indexes to find stems for. Default: All taxa in obj will be used. Any variable name that appears in all_names() can be used as if it was a vector on its own.

value

What data to return. This is usually the name of column in a table in obj$data. Any result of all_names(obj) can be used, but it usually only makes sense to data that corresponds to taxa 1:1, such as taxon_ranks(). By default, taxon indexes are returned.

simplify

(logical) If TRUE, then combine all the results into a single vector of unique values.

exclude_leaves

(logical) If TRUE, the do not include taxa with no subtaxa.

Value

character

See also

Other taxonomy indexing functions: branches(), internodes(), leaves(), roots(), subtaxa(), supertaxa()

Examples

# Return indexes of stem taxa stems(ex_taxmap)
#> $b #> named integer(0) #> #> $c #> c g #> 2 6 #>
# Return indexes for a subset of taxa stems(ex_taxmap, subset = 2:17)
#> $c #> c g #> 2 6 #> #> $d #> named integer(0) #> #> $e #> e j o #> 4 9 14 #> #> $f #> f k p #> 5 10 15 #>
# Return something besides taxon indexes stems(ex_taxmap, value = "taxon_names")
#> $b #> named character(0) #> #> $c #> c g #> "Plantae" "Solanaceae" #>
# Return a vector instead of a list stems(ex_taxmap, value = "taxon_names", simplify = TRUE)
#> c g #> "Plantae" "Solanaceae"