Skip to contents

Return a taxonomic table matching the requested ids

Usage

filter_id(
  id,
  provider = getOption("taxadb_default_provider", "itis"),
  type = c("taxonID", "acceptedNameUsageID"),
  version = latest_version(),
  collect = TRUE,
  db = td_connect()
)

Arguments

id

taxonomic id, in prefix format

provider

from which provider should the hierarchy be returned? Default is 'itis', which can also be configured using options(default_taxadb_provider=..."). See [td_create] for a list of recognized providers.

type

id type. Can be taxonID or acceptedNameUsageID, see details.

version

Which version of the taxadb provider database should we use? defaults to latest. See tl_import for details.

collect

logical, default TRUE. Should we return an in-memory data.frame (default, usually the most convenient), or a reference to lazy-eval table on disk (useful for very large tables on which we may first perform subsequent filtering operations.)

db

a connection to the taxadb database. See details.

Value

a data.frame with id and name of all matching species

Details

Use type="acceptedNameUsageID" to return all rows for which this ID is the accepted ID, including both synonyms and and accepted names (since both all synonyms of a name share the same acceptedNameUsageID.) Use taxonID (default) to only return those rows for which the Scientific name corresponds to the taxonID.

Some providers (e.g. ITIS) assign taxonIDs to synonyms, most others only assign IDs to accepted names. In the latter case, this means requesting taxonID will only match accepted names, while requesting matches to the acceptedNameUsageID will also return any known synonyms. See examples.

See also

Other filter_by: filter_by(), filter_common(), filter_name(), filter_rank()

Examples

# \donttest{

filter_id(c("ITIS:1077358", "ITIS:175089"))
#> # A tibble: 0 × 15
#> # ℹ 15 variables: taxonID <chr>, scientificName <chr>, taxonRank <chr>,
#> #   acceptedNameUsageID <chr>, taxonomicStatus <chr>, update_date <lgl>,
#> #   kingdom <chr>, phylum <chr>, class <chr>, order <chr>, family <chr>,
#> #   genus <chr>, specificEpithet <chr>, vernacularName <chr>,
#> #   infraspecificEpithet <lgl>
filter_id("ITIS:1077358", type="acceptedNameUsageID")
#> # A tibble: 0 × 15
#> # ℹ 15 variables: taxonID <chr>, scientificName <chr>, taxonRank <chr>,
#> #   acceptedNameUsageID <chr>, taxonomicStatus <chr>, update_date <lgl>,
#> #   kingdom <chr>, phylum <chr>, class <chr>, order <chr>, family <chr>,
#> #   genus <chr>, specificEpithet <chr>, vernacularName <chr>,
#> #   infraspecificEpithet <lgl>

# }