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.frameortibblethat 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
.dfare retained in the output. Note that unlikedplyr::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
.dfare kept whencomposite_id()is used to assign values toeventID, defaulting to"all". This has a different default from.keepbecause 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:
SampleObservationSurveySite VisitDeploymentSee 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)
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"
)
#> ⠙ Checking 2 columns: eventID and eventType
#> ✔ Checking 2 columns: eventID and eventType [621ms]
#>
#> # A tibble: 3 × 6
#> site_code scientificName latitude longitue eventID eventType
#> <chr> <chr> <dbl> <dbl> <chr> <chr>
#> 1 AMA100 Crinia signifera -35.3 149. 01-AMA100-year Survey
#> 2 AMA100 Crinia signifera -35.3 149. 02-AMA100-year Survey
#> 3 AMH100 Crinia signifera -35.1 149. 03-AMH100-year Survey
