taxadb (version 0.2.1)

get_ids: get_ids

Description

A drop-in replacement for [taxize::get_ids()]

Usage

get_ids(
  names,
  provider = getOption("taxadb_default_provider", "itis"),
  format = c("prefix", "bare", "uri"),
  version = latest_version(),
  taxadb_db = td_connect(),
  ignore_case = FALSE,
  warn = TRUE,
  db = NULL,
  ...
)

Value

a vector of IDs, of the same length as the input names Any unmatched names or multiply-matched names will return as NAs. To resolve multi-matched names, use [filter_name()] instead to return a table with a separate row for each separate match of the input name.

Arguments

names

a list of scientific names (which may include higher-order ranks in most authorities).

provider

abbreviation code for the provider. See details.

format

Format for the returned identifier, one of

  • prefix (e.g. NCBI:9606, the default), or

  • bare (e.g. 9606, used in taxize::get_ids()),

  • uri (e.g. http://ncbi.nlm.nih.gov/taxonomy/9606).

version

Which version of the taxadb provider database should we use? defaults to latest. see [avialable_releases()] for details.

taxadb_db

Connection to from [td_connect()].

ignore_case

should we ignore case (capitalization) in matching names? default is TRUE.

warn

should we display warnings on NAs resulting from multiply-resolved matches? (Unlike unmatched names, these NAs can usually be resolved manually via filter_id())

db

previous name for provider argument, now deprecated

...

additional arguments (currently ignored)

Details

Note that some taxize authorities: nbn, tropicos, and eol, are not recognized by taxadb and will throw an error here. Meanwhile, taxadb recognizes several authorities not known to [taxize::get_ids()]. Both include itis, ncbi, col, and gbif.

Like all taxadb functions, this function will run fastest if a local copy of the provider is installed in advance using [td_create()].

See Also

filter_name

Other get: get_names()

Examples

Run this code
# \donttest{

  # \dontshow{
   ## All examples use a temporary directory
   options("taxadb_default_provider"="itis_test")
   Sys.setenv(TAXADB_HOME=file.path(tempdir(), "taxadb"))
  # }

get_ids("Midas bicolor")
get_ids(c("Midas bicolor", "Homo sapiens"), format = "prefix")
get_ids("Midas bicolor", format = "uri")

# }

  # \dontshow{
   Sys.unsetenv("TAXADB_HOME")
  # }

Run the code above in your browser using DataLab