db_extract: Get objects and associated metadata

View source: R/objects.R

db_extractR Documentation

Get objects and associated metadata

Description

Get objects and associated metadata

Usage

db_extract(
  db,
  projids,
  ...,
  object_fields = NULL,
  process_fields = NULL,
  acquis_fields = NULL,
  sample_fields = NULL
)

Arguments

db

connection to the database, from ⁠[db_connect_ecotaxa()]⁠.

projids

numeric identifiers of projects to extract data from.

...

additional filters on the objects table. Typical filters are on:

  • classif_qual: "V" for validated, "P" for predicted, "D" for dubious,

  • classif_id: numeric ids of the taxa of interest,

  • sampleid: internal numeric identifiers of the samples (from the "samples" table).

object_fields, process_fields, acquis_fields, sample_fields

vectors of column names to extract in the objects, sample, acquisitions, and process tables. NULL (the default) extracts nothing, "all" extracts all fields.

Value

A tibble with columns that are systematically extracted and the additional metadata requested

Examples

# db <- db_connect_ecotaxa()
# # extract validated objects from a couple projects with some metadata
# d <- db_extract(
#   db, projids=c(658, 756), classif_qual=="V",
#   object_fields=c("area", "major"),
#   process_fields="particle_pixel_size_mm",
#   acquis_fields="sub_part",
#   sample_fields="tot_vol"
# )
# # extract all objects from a project with all object-level metadata
# d <- db_extract(
#   db, projids=658,
#   object_fields="all"
# )

jiho/ecotaxar documentation built on Jan. 16, 2024, 12:26 a.m.