Learn R Programming

taxize (version 0.5.2)

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)

## S3 method for class 'nbnid': as.nbnid(x, check = TRUE)

## S3 method for class 'character': as.nbnid(x, check = TRUE)

## S3 method for class 'list': as.nbnid(x, check = TRUE)

## S3 method for class 'data.frame': as.nbnid(x, check = TRUE)

## S3 method for class 'nbnid': 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 inifity. 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
...
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 unique identifiers. If a taxon is not found NA. If more than one ID is found the function asks for user input.

See Also

get_tsn, get_uid, get_tpsid, get_eolid

Examples

Run this code
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)

Run the code above in your browser using DataLab