set_events: Set, create or modify columns with Event information

View source: R/set_events.R

set_eventsR Documentation

Set, create or modify columns with Event information

Description

Identify or format columns that contain information about an Event. An "Event" in Darwin Core Standard refers to an action that occurs at a place and time. Examples include:

  • A specimen collecting event

  • A survey or sampling event

  • A camera trap image capture

  • A marine trawl

  • A camera trap deployment event

  • A camera trap burst image event (with many images for one observation)

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

Usage

set_events(
  .df,
  eventID = NULL,
  eventType = NULL,
  parentEventID = NULL,
  .keep = "unused",
  .keep_composite = "all"
)

Arguments

.df

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

eventID

A unique identifier for an individual Event.

eventType

The type of Event

parentEventID

The parent event under which one or more Events sit within.

.keep

Control which columns from .df 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.

.keep_composite

Control which columns from .df are kept when composite_id() is used to assign values to eventID, defaulting to "all". This has a different default from .keep because composite identifiers often contain information that is valuable in other contexts, meaning that deleting these columns by default is typically unwise.

Details

Each Event requires a unique eventID and eventType (because there can be several types of Events in a single dataset), along with a parentEventID which specifies the level under which the current Event sits (e.g., An individual location's survey event ID, which is one of several survey locations on a specific day's set of surveys ie the parentEvent).

Examples of eventID values:

  • INBO:VIS:Ev:00009375

Examples of eventType values:

  • Sample

  • Observation

  • Survey

  • ⁠Site Visit⁠

  • Deployment See more examples on dwc.tdwg.org

Examples of parentEventID A1 (To identify the parent event in nested samples, each with their own eventID - A1_1, A1_2)

Value

A tibble with the requested fields added/reformatted.

Examples

# example Event dataframe
df <- tibble::tibble(
  site_code = c("AMA100", "AMA100", "AMH100"),
  scientificName = c("Crinia signifera", "Crinia signifera", "Crinia signifera"),
  latitude = c(-35.275, -35.274, -35.101),
  longitue = c(149.001, 149.004, 149.274),
  )

# Add event information
df |>
  set_events(
    eventID = composite_id(sequential_id(),
                           site_code,
                           year),
    eventType = "Survey"
    )


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