Learn R Programming

taxize (version 0.6.0)

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, family = NULL, rank = NULL, ...)

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_
family
(character) A family name. Optional. See Filtering below.
rank
(character) A taxonomic rank name. See rank_ref for possible options. Though note that some data sources use atypical ranks, so inspect the data itself for options. Optional. See Filtering bel
...
Ignored
x
Input to as.ubioid
check
logical; Check if ID matches any existing on the DB, only used in as.ubioid

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')

Filtering

The parameters family and rank are not used in the search to the data provider, but are used in filtering the data down to a subset that is closer to the target you want. For all these parameters, you can use regex strings since we use grep internally to match.

See Also

get_uid, ubio_search

Examples

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

# Narrow down results to a division or rank, or both
## Satyrium example
### Results w/o narrowing
get_ubioid("Satyrium")
### w/ rank
get_ubioid("Satyrium", rank = "var")
get_ubioid("Satyrium", family = "Lycaenidae", rank = "species")

## w/ family
get_ubioid("Zootoca vivipara")
get_ubioid("Zootoca vivipara", family = "Reptilia")
get_ubioid("Zootoca vivipara", family = "Reptilia", rank = "species")
get_ubioid("Zootoca vivipara", family = "Lacertidae", rank = "species")

# Fuzzy filter on any filtering fields
## uses grep on the inside
get_ubioid("Satyrium", family = "*idae")
get_ubioid("Satyrium", family = "*tera")

# 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)

# use curl options
library("httr")
get_ubioid("Quercus douglasii", config=verbose())
bb <- get_ubioid("Quercus douglasii", config=progress())

Run the code above in your browser using DataLab