Connects to a frozen CalCOFI DuckLake release. Downloads and caches the database locally for fast subsequent access.

cc_get_db(
  version = "latest",
  local_cache = TRUE,
  cache_dir = NULL,
  refresh = FALSE
)

Arguments

version

Version string (e.g., "v2026.02") or "latest" (default)

local_cache

Use local cache if available (default: TRUE)

cache_dir

Directory for local cache. Default uses rappdirs::user_cache_dir("calcofi4r") if rappdirs is installed, otherwise a temp directory.

refresh

Force re-download even if cached (default: FALSE)

Value

DuckDB connection object

Details

The frozen releases contain clean, stable data without provenance columns, suitable for analysis and visualization. Use cc_list_versions() to see available releases.

The connection points to Parquet files from the frozen release, which are registered as views in DuckDB. This allows querying the data without downloading the entire database.

Data is stored at gs://calcofi-db/ducklake/releases/{version}/.

Examples

if (FALSE) { # \dontrun{
# connect to latest release
con <- cc_get_db()
DBI::dbListTables(con)

# connect to specific version
con <- cc_get_db(version = "v2026.02")

# query data
DBI::dbGetQuery(con, "SELECT COUNT(*) FROM larvae")
} # }