taxize (version 0.9.91)

get_tolid: Get the OTT id for a search term

Description

Retrieve the Open Tree of Life Taxonomy (OTT) id of a taxon from OpenTreeOfLife

Usage

get_tolid(sciname, ask = TRUE, messages = TRUE, rows = NA, ...)

as.tolid(x, check = TRUE)

# S3 method for tolid as.tolid(x, check = TRUE)

# S3 method for character as.tolid(x, check = TRUE)

# S3 method for list as.tolid(x, check = TRUE)

# S3 method for numeric as.tolid(x, check = TRUE)

# S3 method for data.frame as.tolid(x, check = TRUE)

# S3 method for tolid as.data.frame(x, ...)

get_tolid_(sciname, messages = TRUE, rows = NA)

Arguments

sciname

character; scientific name. Or, a taxon_state object (see taxon-state)

ask

logical; should get_tolid be run in interactive mode? If TRUE and more than one TOL is found for the species, the user is asked for input. If FALSE NA is returned for multiple matches.

messages

logical; should progress be printed?

rows

numeric; Any number from 1 to infinity. If the default NA, all rows are considered. Note that this function still only gives back a tol class object with one to many identifiers. See get_tolid_() to get back all, or a subset, of the raw data that you are presented during the ask process.

...

Ignored

x

Input to as.tolid

check

logical; Check if ID matches any existing on the DB, only used in as.tolid()

Value

A vector of taxonomic identifiers as an S3 class. If a taxon is not found an NA is given. If more than one identifier is found the function asks for user input if ask = TRUE, otherwise returns NA. If ask=FALSE and rows does not equal NA, then a data.frame is given back, but not of the uid class, which you can't pass on to other functions as you normally can.

See get_id_details for further details including attributes and exceptions

See Also

classification()

Other taxonomic-ids: get_boldid, get_colid, get_eolid, get_gbifid, get_ids, get_iucn, get_natservid, get_nbnid, get_pow, get_tpsid, get_tsn, get_uid, get_wiki, get_wormsid

Examples

Run this code
# NOT RUN {
get_tolid(sciname = "Quercus douglasii")
get_tolid(sciname = "Chironomus riparius")
get_tolid(c("Chironomus riparius","Quercus douglasii"))
splist <- c("annona cherimola", 'annona muricata', "quercus robur",
		"shorea robusta", "pandanus patina", "oryza sativa", "durio zibethinus")
get_tolid(splist, messages=FALSE)

# specify rows to limit choices available
get_tolid('Arni')
get_tolid('Arni', rows=1)
get_tolid('Arni', rows=1:2)

# When not found
get_tolid("howdy")
get_tolid(c("Chironomus riparius", "howdy"))

# Convert a tol without class information to a tol class
as.tolid(get_tolid("Quercus douglasii")) # already a tol, returns the same
as.tolid(get_tolid(c("Chironomus riparius","Pinus contorta"))) # same
as.tolid(5907893) # numeric
as.tolid(c(3930798,515712,872577)) # numeric vector, length > 1
as.tolid("3930798") # character
as.tolid(c("3930798","515712","872577")) # character vector, length > 1
as.tolid(list("3930798","515712","872577")) # list, either numeric or character
## dont check, much faster
as.tolid("3930798", check=FALSE)
as.tolid(3930798, check=FALSE)
as.tolid(c("3930798","515712","872577"), check=FALSE)
as.tolid(list("3930798","515712","872577"), check=FALSE)

(out <- as.tolid(c(3930798,515712,872577)))
data.frame(out)
as.tolid( data.frame(out) )

# Get all data back
get_tolid_(sciname="Arni")
get_tolid_("Arni", rows=1)
get_tolid_("Arni", rows=1:2)
get_tolid_(c("asdfadfasd","Pinus contorta"))
# }

Run the code above in your browser using DataCamp Workspace