R/events.R

Defines functions events

Documented in events

#' Get events
#'
#' Gets the (unique) events from the observations of a Camera Trap Data
#' Package object.
#' Only observations with `observationLevel == "event"` are considered.
#'
#' @inheritParams print.camtrapdp
#' @return [tibble::tibble()] data frame with the events, containing the following
#'   columns:
#'   - `deploymentID`
#'   - `eventID`
#'   - `eventStart`
#'   - `eventEnd`
#' @family accessor functions
#' @export
#' @examples
#' x <- example_dataset()
#' events(x)
events <- function(x) {
  check_camtrapdp(x)
  observations(x) %>%
    dplyr::filter(.data$observationLevel == "event") %>%
    dplyr::distinct(
      .data$deploymentID,
      .data$eventID,
      .data$eventStart,
      .data$eventEnd
    )
}

Try the camtrapdp package in your browser

Any scripts or data that you put into this service are public.

camtrapdp documentation built on Sept. 11, 2024, 9:03 p.m.