Skip to contents

Return a reference to a given table in the taxadb database

Usage

taxa_tbl(
  provider = getOption("taxadb_default_provider", "itis"),
  schema = c("dwc", "common"),
  version = latest_version(),
  db = td_connect()
)

Arguments

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.

schema

One of "dwc" (for Darwin Core data) or "common" (for the Common names table.)

version

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

db

a connection to the taxadb database. See details.

Examples

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

  ## default schema is the dwc table
  taxa_tbl()
#> # Source:   table<"v22.12_dwc_itis_test"> [?? x 15]
#> # Database: DuckDB v0.10.1 [unknown@Linux 6.5.0-1017-azure:R 4.3.3/:memory:]
#>    taxonID      scientificName     taxonRank acceptedNameUsageID taxonomicStatus
#>    <chr>        <chr>              <chr>     <chr>               <chr>          
#>  1 ITIS:1025094 Leontopithecus fu… species   ITIS:1025093        synonym        
#>  2 ITIS:1025099 Midas tripartitus  species   ITIS:1025098        synonym        
#>  3 ITIS:1025101 Hapale nigrifrons  species   ITIS:1025100        synonym        
#>  4 ITIS:1025103 Midas bicolor      species   ITIS:572923         synonym        
#>  5 ITIS:1025108 Simia lugens       species   ITIS:1025104        synonym        
#>  6 ITIS:1025109 Callitrix torquat… species   ITIS:1025106        synonym        
#>  7 ITIS:1025118 Callithrix donaco… species   ITIS:1025112        synonym        
#>  8 ITIS:1025123 Callithrix cinera… species   ITIS:1025122        synonym        
#>  9 ITIS:1025135 Plecturocebus dub… species   ITIS:1025134        synonym        
#> 10 ITIS:1025136 Callithrix caliga… species   ITIS:1025134        synonym        
#> # ℹ more rows
#> # ℹ 10 more variables: update_date <lgl>, kingdom <chr>, phylum <chr>,
#> #   class <chr>, order <chr>, family <chr>, genus <chr>, specificEpithet <chr>,
#> #   vernacularName <chr>, infraspecificEpithet <lgl>

  ## common names table
  taxa_tbl(schema = "common")
#> # Source:   table<"v22.12_common_itis_test"> [?? x 16]
#> # Database: DuckDB v0.10.1 [unknown@Linux 6.5.0-1017-azure:R 4.3.3/:memory:]
#>    vernacularName language update_date acceptedNameUsageID taxonID    
#>    <chr>          <chr>    <date>      <chr>               <chr>      
#>  1 man            English  2002-07-30  ITIS:180092         ITIS:944513
#>  2 man            English  2002-07-30  ITIS:180092         ITIS:944514
#>  3 man            English  2002-07-30  ITIS:180092         ITIS:944515
#>  4 man            English  2002-07-30  ITIS:180092         ITIS:944516
#>  5 man            English  2002-07-30  ITIS:180092         ITIS:944517
#>  6 man            English  2002-07-30  ITIS:180092         ITIS:944518
#>  7 man            English  2002-07-30  ITIS:180092         ITIS:944519
#>  8 man            English  2002-07-30  ITIS:180092         ITIS:944520
#>  9 man            English  2002-07-30  ITIS:180092         ITIS:944521
#> 10 man            English  2002-07-30  ITIS:180092         ITIS:944522
#> # ℹ more rows
#> # ℹ 11 more variables: scientificName <chr>, taxonRank <chr>,
#> #   taxonomicStatus <chr>, kingdom <chr>, phylum <chr>, class <chr>,
#> #   order <chr>, family <chr>, genus <chr>, specificEpithet <chr>,
#> #   infraspecificEpithet <lgl>



# }