Learn R Programming

taxize (version 0.7.9)

get_nbnid: Get the UK National Biodiversity Network ID from taxonomic names.

Description

Get the UK National Biodiversity Network ID from taxonomic names.

Usage

get_nbnid(name, ask = TRUE, verbose = TRUE, rec_only = FALSE, rank = NULL, rows = NA, ...)
as.nbnid(x, check = TRUE)
"as.nbnid"(x, check = TRUE)
"as.nbnid"(x, check = TRUE)
"as.nbnid"(x, check = TRUE)
"as.nbnid"(x, check = TRUE)
"as.data.frame"(x, ...)
get_nbnid_(name, verbose = TRUE, rec_only = FALSE, rank = NULL, rows = NA, ...)

Arguments

name
character; scientific name.
ask
logical; should get_nbnid 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.
rec_only
(logical) If TRUE ids of recommended names are returned (i.e. synonyms are removed). Defaults to FALSE. Remember, the id of a synonym is a taxa with 'recommended' name status.
rank
(character) If given, we attempt to limit the results to those taxa with the matching rank.
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 nbnid class object with one to many identifiers. See get_nbnid_ to get back all, or a subset, of the raw data that you are presented during the ask process.
...
Further args passed on to nbn_search
x
Input to as.nbnid
check
logical; Check if ID matches any existing on the DB, only used in as.nbnid

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

See Also

get_tsn, get_uid, get_tpsid, get_eolid, get_colid, get_ids, classification

Examples

Run this code
## Not run: 
# get_nbnid(name='Poa annua')
# get_nbnid(name='Poa annua', rec_only=TRUE)
# get_nbnid(name='Poa annua', rank='Species')
# get_nbnid(name='Poa annua', rec_only=TRUE, rank='Species')
# get_nbnid(name='Pinus contorta')
# 
# # The NBN service handles common names too
# get_nbnid(name='red-winged blackbird')
# 
# # specify rows to limit choices available
# get_nbnid('Poa annua')
# get_nbnid('Poa annua', rows=1)
# get_nbnid('Poa annua', rows=25)
# get_nbnid('Poa annua', rows=1:2)
# 
# # When not found
# get_nbnid(name="uaudnadndj")
# get_nbnid(c("Zootoca vivipara", "uaudnadndj"))
# get_nbnid(c("Zootoca vivipara","Chironomus riparius", "uaudnadndj"))
# 
# # Convert an nbnid without class information to a nbnid class
# as.nbnid(get_nbnid("Zootoca vivipara")) # already a nbnid, returns the same
# as.nbnid(get_nbnid(c("Zootoca vivipara","Pinus contorta"))) # same
# as.nbnid('NHMSYS0001706186') # character
# as.nbnid(c("NHMSYS0001706186","NHMSYS0000494848","NBNSYS0000010867")) # character vector, length > 1
# as.nbnid(list("NHMSYS0001706186","NHMSYS0000494848","NBNSYS0000010867")) # list
# ## dont check, much faster
# as.nbnid('NHMSYS0001706186', check=FALSE)
# as.nbnid(list("NHMSYS0001706186","NHMSYS0000494848","NBNSYS0000010867"), check=FALSE)
# 
# (out <- as.nbnid(c("NHMSYS0001706186","NHMSYS0000494848","NBNSYS0000010867")))
# data.frame(out)
# as.nbnid( data.frame(out) )
# 
# # Get all data back
# get_nbnid_("Zootoca vivipara")
# get_nbnid_("Poa annua", rows=2)
# get_nbnid_("Poa annua", rows=1:2)
# get_nbnid_(c("asdfadfasd","Pinus contorta"), rows=1:5)
# 
# # use curl options
# library("httr")
# get_nbnid("Quercus douglasii", config=verbose())
# bb <- get_nbnid("Quercus douglasii", config=progress())
# ## End(Not run)

Run the code above in your browser using DataLab