filter_media {camtrapdp}R Documentation

Filter media

Description

Subsets media in a Camera Trap Data Package object, retaining all rows that satisfy the conditions.

Usage

filter_media(x, ...)

Arguments

x

Camera Trap Data Package object, as returned by read_camtrapdp().

...

Filtering conditions, see dplyr::filter().

Details

Value

x filtered.

See Also

Other filter functions: filter_deployments(), filter_observations()

Examples

x <- example_dataset()

# Filtering returns x, so pipe with media() to see the result
x %>%
  filter_media(captureMethod == "timeLapse") %>%
  media()

# Filtering on media also affects associated observations, but not deployments
x_filtered <- filter_media(x, favorite == TRUE)
observations(x_filtered)

# Filtering on multiple conditions (combined with &)
x %>%
  filter_media(captureMethod == "activityDetection", filePublic == FALSE) %>%
  media()

# Filtering on datetimes is easiest with lubridate
library(lubridate, warn.conflicts = FALSE)
x %>%
  filter_media(
    timestamp >= lubridate::as_datetime("2020-08-02 05:01:00"),
    timestamp <= lubridate::as_datetime("2020-08-02 05:02:00")
  ) %>%
  media()

[Package camtrapdp version 0.3.1 Index]