
Set, create or modify columns with museum- or collection-specific information
Source:R/set_collection.R
set_collection.Rd
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
ortibble
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
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
)
#> ⠙ Checking 2 columns: catalogNumber and datasetName
#> ✔ Checking 2 columns: catalogNumber and datasetName [621ms]
#>
#> # A tibble: 3 × 4
#> name eventDate catalogNumber datasetName
#> <chr> <chr> <chr> <chr>
#> 1 Crinia Signifera 2010-10-14 16789a Frog search
#> 2 Crinia Signifera 2010-10-14 16789c Frog search
#> 3 Litoria peronii 2010-10-14 08742f Frog search