taxize (version 0.9.91)

get_wormsid: Get Worms ID for a taxon name

Description

Retrieve Worms ID of a taxon from World Register of Marine Species (WORMS).

Usage

get_wormsid(query, searchtype = "scientific", accepted = FALSE,
  ask = TRUE, messages = TRUE, rows = NA, ...)

as.wormsid(x, check = TRUE)

# S3 method for wormsid as.wormsid(x, check = TRUE)

# S3 method for character as.wormsid(x, check = TRUE)

# S3 method for list as.wormsid(x, check = TRUE)

# S3 method for numeric as.wormsid(x, check = TRUE)

# S3 method for data.frame as.wormsid(x, check = TRUE)

# S3 method for wormsid as.data.frame(x, ...)

get_wormsid_(query, messages = TRUE, searchtype = "scientific", accepted = TRUE, rows = NA, ...)

Arguments

query

character; A vector of common or scientific names. Or, a taxon_state object (see taxon-state)

searchtype

character; One of 'scientific' or 'common', or any unique abbreviation

accepted

logical; If TRUE, removes names that are not accepted valid names by WORMS. Set to FALSE (default) to give back both accepted and unaccepted names.

ask

logical; should get_wormsid be run in interactive mode? If TRUE and more than one wormsid is found for the species, the user is asked for input. If FALSE NA is returned for multiple matches.

messages

logical; should progress be printed?

rows

numeric; Any number from 1 to infinity. If the default NaN, all rows are considered. Note that this function still only gives back a wormsid class object with one to many identifiers. See get_wormsid_() to get back all, or a subset, of the raw data that you are presented during the ask process.

...

Ignored

x

Input to as.wormsid

check

logical; Check if ID matches any existing on the DB, only used in as.wormsid()

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.

See get_id_details for further details including attributes and exceptions

See Also

classification()

Other taxonomic-ids: get_boldid, get_colid, get_eolid, get_gbifid, get_ids, get_iucn, get_natservid, get_nbnid, get_pow, get_tolid, get_tpsid, get_tsn, get_uid, get_wiki

Examples

Run this code
# NOT RUN {
(x <- get_wormsid('Gadus morhua'))
attributes(x)
attr(x, "match")
attr(x, "multiple_matches")
attr(x, "pattern_match")
attr(x, "uri")

get_wormsid('Pomatomus saltatrix')
get_wormsid(c("Gadus morhua", "Lichenopora neapolitana"))

# by common name
get_wormsid("dolphin", 'common')
get_wormsid("clam", 'common')

# specify rows to limit choices available
get_wormsid('Plat')
get_wormsid('Plat', rows=1)
get_wormsid('Plat', rows=1:2)

# When not found
get_wormsid("howdy")
get_wormsid(c('Gadus morhua', "howdy"))

# Convert a wormsid without class information to a wormsid class
# already a wormsid, returns the same
as.wormsid(get_wormsid('Gadus morhua'))
# same
as.wormsid(get_wormsid(c('Gadus morhua', 'Pomatomus saltatrix')))
# numeric
as.wormsid(126436)
# numeric vector, length > 1
as.wormsid(c(126436,151482))
# character
as.wormsid("126436")
# character vector, length > 1
as.wormsid(c("126436","151482"))
# list, either numeric or character
as.wormsid(list("126436","151482"))
## dont check, much faster
as.wormsid("126436", check=FALSE)
as.wormsid(126436, check=FALSE)
as.wormsid(c("126436","151482"), check=FALSE)
as.wormsid(list("126436","151482"), check=FALSE)

(out <- as.wormsid(c(126436,151482)))
data.frame(out)
as.wormsid( data.frame(out) )

# Get all data back
get_wormsid_("Plat")
get_wormsid_("Plat", rows=1)
get_wormsid_("Plat", rows=1:2)
get_wormsid_("Plat", rows=1:75)
# get_wormsid_(c("asdfadfasd","Plat"), rows=1:5)
# }

Run the code above in your browser using DataLab