set_collection: Set, create or modify columns with museum- or...

View source: R/set_collection.R

set_collectionR Documentation

Set, create or modify columns with museum- or collection-specific information

Description

Format fields that specify the collection or catalog number of a specimen or occurrence record to a tibble using Darwin Core Standard.

In practice this is no different from using mutate(), but gives some informative errors, and serves as a useful lookup for fields in the Darwin Core Standard.

Usage

set_collection(
  .df,
  datasetID = NULL,
  datasetName = NULL,
  catalogNumber = NULL,
  .keep = "unused"
)

Arguments

.df

A data.frame or tibble that the column should be appended to.

datasetID

An identifier for the set of data. May be a global unique identifier or an identifier specific to a collection or institution.

datasetName

The name identifying the data set from which the record was derived.

catalogNumber

A unique identifier for the record within the data set or collection.

.keep

Control which columns from .data are retained in the output. Note that unlike dplyr::mutate(), which defaults to "all" this defaults to "unused"; i.e. only keeps Darwin Core columns, and not those columns used to generate them.

Details

Examples of datasetID values:

  • ⁠b15d4952-7d20-46f1-8a3e-556a512b04c5⁠

Examples of datasetName values:

  • ⁠Grinnell Resurvey Mammals⁠

  • ⁠Lacey Ctenomys Recaptures⁠

Examples of catalogNumber values:

  • 145732

  • ⁠145732a⁠

  • 2008.1334

  • R-4313

Value

A tibble with the requested fields added/reformatted.

Examples

df <- tibble::tibble(
  name = c("Crinia Signifera", "Crinia Signifera", "Litoria peronii"),
  eventDate = c("2010-10-14", "2010-10-14", "2010-10-14"),
  catalog_num = c("16789a", "16789c", "08742f"),
  dataset = c("Frog search", "Frog search", "Frog search")
  )

# Reformat columns to Darwin Core terms
df |>
  set_collection(
    catalogNumber = catalog_num,
    datasetName = dataset
    )


corella documentation built on April 4, 2025, 12:20 a.m.