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

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

Arguments

names

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

db

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.

...

additional arguments (currently ignored)

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.

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

# \donttest{ get_ids("Homo sapiens")
#> [1] "ITIS:180092"
get_ids(c("Homo sapiens", "Mammalia"), format = "prefix")
#> [1] "ITIS:180092" "ITIS:179913"
get_ids("Homo sapiens", db= "ncbi", format = "uri")
#> Importing /tmp/RtmpUiM8jB/2019_dwc_ncbi.tsv.bz2 in 100000 line chunks:
#> ...Done! (in 2.597628 mins)
#> [1] "http://ncbi.nlm.nih.gov/taxonomy/9606"
# }