Returns a connection to the local CITES database. This is a DBI-compliant MonetDBLite::MonetDBLite() database connection. When using dplyr-based workflows, one typically accesses tables with functions such as cites_shipments(), but this function lets one interact with the database directly via SQL.

cites_db(dbdir = cites_path())

Arguments

dbdir

The location of the database on disk. Defaults to citesdb under rappdirs::user_data_dir(), or the environment variable CITES_DB_DIR.

Value

A MonetDBLite DBI connection

Examples

if (cites_status()) { library(DBI) dbListTables(cites_db()) parties <- dbReadTable(cites_db(), "cites_parties") dbGetQuery( cites_db(), 'SELECT "Taxon", "Importer" FROM cites_shipments WHERE "Year" = 1976 LIMIT 100;' ) }
#> Local CITES database empty or corrupt. Download with cites_db_download()