Learn R Programming

taxize (version 0.5.2)

get_ubioid: Get the uBio id for a search term.

Description

Retrieve the uBio id of a taxon. This function uses ubio_search internally to search for names.

Usage

get_ubioid(searchterm, searchtype = "scientific", ask = TRUE,
  verbose = TRUE, rows = NA)

as.ubioid(x, check = TRUE)

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

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

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

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

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

## S3 method for class 'ubioid': as.data.frame(x, ...)

get_ubioid_(searchterm, verbose = TRUE, searchtype = "scientific", rows = NA)

Arguments

searchterm
character; A vector of common or scientific names.
searchtype
character; One of 'scientific' or 'common', or any unique abbreviation
ask
logical; should get_tsn be run in interactive mode? If TRUE and more than one TSN is found for teh species, the user is asked for input. If FALSE NA is returned for multiple matches.
verbose
logical; should progress be printed?
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 ubioid class object with one to many identifiers. See get_ubioid_
x
Input to as.ubioid
check
logical; Check if ID matches any existing on the DB, only used in as.ubioid
...
Ignored

Value

  • A vector of uBio ids. If a taxon is not found NA is given. If more than one uBio id is found the function asks for user input (if ask = TRUE), otherwise returns NA. Comes with an attribute match to investigate the reason for NA (either 'not found', 'found' or if ask = FALSE 'multi match')

See Also

get_uid, ubio_search

Examples

Run this code
get_ubioid(searchterm = "Astragalus aduncus")
get_ubioid(c("Salvelinus fontinalis","Pomacentrus brachialis"))
splist <- c("Salvelinus fontinalis", 'Pomacentrus brachialis', "Leptocottus armatus",
		"Clinocottus recalvus", "Trachurus trachurus", "Harengula clupeola")
get_ubioid(splist, verbose=FALSE)

# specify rows to limit choices available
get_ubioid('Astragalus aduncus')
get_ubioid('Astragalus aduncus', rows=1)
get_ubioid('Astragalus aduncus', rows=8)
get_ubioid('Astragalus aduncus', rows=1:2)

# When not found
get_ubioid(searchterm="howdy")
get_ubioid(c("Salvelinus fontinalis", "howdy"))

# Using common names
get_ubioid(searchterm="great white shark", searchtype="common")
get_ubioid(searchterm=c("bull shark", "whale shark"), searchtype="common")

# Convert a ubioid without class information to a ubioid class
as.ubioid(get_ubioid("Astragalus aduncus")) # already a ubioid, returns the same
as.ubioid(get_ubioid(c("Chironomus riparius","Pinus contorta"))) # same
as.ubioid(2843601) # numeric
as.ubioid(c(2843601,3339,9696)) # numeric vector, length > 1
as.ubioid("2843601") # character
as.ubioid(c("2843601","3339","9696")) # character vector, length > 1
as.ubioid(list("2843601","3339","9696")) # list, either numeric or character
## dont check, much faster
as.ubioid("2843601", check=FALSE)
as.ubioid(2843601, check=FALSE)
as.ubioid(c("2843601","3339","9696"), check=FALSE)
as.ubioid(list("2843601","3339","9696"), check=FALSE)

(out <- as.ubioid(c(2843601,3339,9696)))
data.frame(out)
as.ubioid( data.frame(out) )

# Get all data back
get_ubioid_("Zootoca vivipara")
get_ubioid_("Zootoca vivipara", rows=2)
get_ubioid_("Zootoca vivipara", rows=1:2)
get_ubioid_(c("asdfadfasd","Zootoca vivipara"), rows=1:5)

Run the code above in your browser using DataLab