Learn R Programming

taxize (version 0.7.9)

get_eolid: Get the EOL ID from Encyclopedia of Life from taxonomic names.

Description

Note that EOL doesn't expose an API endpoint for directly querying for EOL taxon ID's, so we first use the function eol_search to find pages that deal with the species of interest, then use eol_pages to find the actual taxon IDs.

Usage

get_eolid(sciname, ask = TRUE, verbose = TRUE, key = NULL, rows = NA, ...)
as.eolid(x, check = TRUE)
"as.eolid"(x, check = TRUE)
"as.eolid"(x, check = TRUE)
"as.eolid"(x, check = TRUE)
"as.eolid"(x, check = TRUE)
"as.eolid"(x, check = TRUE)
"as.data.frame"(x, ...)
get_eolid_(sciname, verbose = TRUE, key = NULL, rows = NA, ...)

Arguments

sciname
character; scientific name.
ask
logical; should get_eolid be run in interactive mode? If TRUE and more than one ID is found for the species, the user is asked for input. If FALSE NA is returned for multiple matches.
verbose
logical; If TRUE the actual taxon queried is printed on the console.
key
API key
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 eolid class object with one to many identifiers. See get_eolid_ to get back all, or a subset, of the raw data that you are presented during the ask process.
...
Further args passed on to eol_search()
x
Input to as.eolid
check
logical; Check if ID matches any existing on the DB, only used in as.eolid

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.Comes with the following attributes:
  • match (character) - the reason for NA, either 'not found', 'found' or if ask = FALSE then 'NA due to ask=FALSE')
  • multiple_matches (logical) - Whether multiple matches were returned by the data source. This can be TRUE, even if you get 1 name back because we try to pattern match the name to see if there's any direct matches. So sometimes this attribute is TRUE, as well as pattern_match, which then returns 1 resulting name without user prompt.
  • pattern_match (logical) - Whether a pattern match was made. If TRUE then multiple_matches must be TRUE, and we found a perfect match to your name, ignoring case. If FALSE

Details

EOL is a bit odd in that they have page IDs for each taxon, but then within that, they have taxon ids for various taxa within that page (e.g., GBIF and NCBI each have a taxon they refer to within the page [i.e., taxon]). And we need the taxon ids from a particular data provider (e.g, NCBI) to do other things, like get a higher classification tree. However, humans want the page id, not the taxon id. So, the id returned from this function is the taxon id, not the page id. You can get the page id for a taxon by using eol_search and eol_pages, and the URI returned in the attributes for a taxon will lead you to the taxon page, and the ID in the URL is the page id.

See Also

get_tsn, get_uid, get_tpsid, get_gbifid, get_colid, get_ids, classification

Examples

Run this code
## Not run: 
# get_eolid(sciname='Pinus contorta')
# get_eolid(sciname='Puma concolor')
# 
# get_eolid(c("Puma concolor", "Pinus contorta"))
# 
# # specify rows to limit choices available
# get_eolid('Poa annua')
# get_eolid('Poa annua', rows=1)
# get_eolid('Poa annua', rows=2)
# get_eolid('Poa annua', rows=1:2)
# 
# # When not found
# get_eolid(sciname="uaudnadndj")
# get_eolid(c("Chironomus riparius", "uaudnadndj"))
# 
# # Convert a eolid without class information to a eolid class
# as.eolid(get_eolid("Chironomus riparius")) # already a eolid, returns the same
# as.eolid(get_eolid(c("Chironomus riparius","Pinus contorta"))) # same
# as.eolid(24954444) # numeric
# as.eolid(c(24954444,51389511,57266265)) # numeric vector, length > 1
# as.eolid("24954444") # character
# as.eolid(c("24954444","51389511","57266265")) # character vector, length > 1
# as.eolid(list("24954444","51389511","57266265")) # list, either numeric or character
# ## dont check, much faster
# as.eolid("24954444", check=FALSE)
# as.eolid(24954444, check=FALSE)
# as.eolid(c("24954444","51389511","57266265"), check=FALSE)
# as.eolid(list("24954444","51389511","57266265"), check=FALSE)
# 
# (out <- as.eolid(c(24954444,51389511,57266265)))
# data.frame(out)
# as.eolid( data.frame(out) )
# 
# # Get all data back
# get_eolid_("Poa annua")
# get_eolid_("Poa annua", rows=2)
# get_eolid_("Poa annua", rows=1:2)
# get_eolid_(c("asdfadfasd", "Pinus contorta"))
# ## End(Not run)

Run the code above in your browser using DataLab