Extract numeric OTT ids from a character vector that combines taxon names and OTT ids.
Source:R/opentree_taxonomy_general.R
extract_ott_ids.Rd
Extract numeric OTT ids from a character vector that combines taxon names and OTT ids.
Arguments
- x
A character vector of taxon names, or a phylo object with tree tip labels containing OTT ids.
- na.rm
A logical value indicating whether
NA
values should be stripped from the output.
Examples
if (FALSE) # This is a flag for package development. You are welcome to run the example.
canis <- rotl::tnrs_match_names("canis")
canis_taxonomy <- rotl::taxonomy_subtree(canis$ott_id)
#> Error in eval(expr, envir, enclos): object 'canis' not found
my_ott_ids <- extract_ott_ids(x = canis_taxonomy$tip_label)
#> Error in eval(expr, envir, enclos): object 'canis_taxonomy' not found
# Get the problematic elements from input
canis_taxonomy$tip_label[attr(my_ott_ids, "na.action")]
#> Error in eval(expr, envir, enclos): object 'canis_taxonomy' not found
# end dontrun