Learn R Programming

camtrapR (version 3.0.0)

readcamtrapDP: Convert Camtrap DP format data to camtrapR format

Description

This function converts camera trap data from the Camtrap DP standard format to the format used by camtrapR. Camtrap DP is an open standard for the FAIR exchange and archiving of camera trap data, structured in a simple yet flexible data model consisting of three tables: Deployments, Media, and Observations.

Usage

readcamtrapDP(
  deployments_file = "deployments.csv",
  media_file = "media.csv",
  observations_file = "observations.csv",
  datapackage_file = "datapackage.json",
  min_gap_hours = 24,
  removeNA = FALSE,
  removeEmpty = FALSE,
  remove_bbox = TRUE,
  add_file_path = FALSE,
  filter_observations = NULL
)

Value

List containing three elements:

  • CTtable: Data frame with camera trap deployment information in camtrapR format

  • recordTable: Data frame with species records in camtrapR format

  • metadata: List containing project metadata extracted from datapackage.json

Arguments

deployments_file

character. Path to deployments.csv file

media_file

character. Path to media.csv file

observations_file

character. Path to observations.csv file

datapackage_file

character. Path to datapackage.json file

min_gap_hours

numeric. Minimum gap in hours to consider as a camera interruption (default: 24)

removeNA

logical. Whether to remove columns with only NA values

removeEmpty

logical. Whether to remove columns with only empty values

remove_bbox

logical. Whether to remove bounding box columns in the observation table

add_file_path

logical. Whether to add file path from media table to the observation table

filter_observations

Controls which observation types to include. NULL or FALSE keeps all observations (default), TRUE keeps only animal observations, or provide a character vector of specific observation types to include.

Details

Camtrap DP is a standardized format developed under the umbrella of the Biodiversity Information Standards (TDWG) that facilitates data exchange between different camera trap platforms and systems. It supports a wide range of camera deployment designs, classification techniques, and analytical use cases.

While the 'camtrapdp' package (available on CRAN) provides general functionality for reading, manipulating, and transforming Camtrap DP data, this function specifically converts Camtrap DP data directly into the format required by camtrapR, producing the CTtable and recordTable objects that camtrapR functions expect.

This function reads the three primary tables from a Camtrap DP dataset:

  • Deployments: Information about camera trap placements

  • Observations: Classifications derived from the media files

  • Media: Information about the media files (images/videos) recorded

The Media table is only read if the add_file_path parameter is set to TRUE.

The function converts these into two primary camtrapR data structures:

  • CTtable: Contains deployment information including station ID, setup/retrieval dates, camera operation problems, camera setup, and more

  • recordTable: Contains observation records with taxonomic and temporal information

Additional features include:

  • Parsing of deploymentTags and deploymentGroups (in deployments) and observationTags (in observations)

  • Extraction of taxonomic information from metadata

  • Handling of deployment intervals and gaps

References

Bubnicki, J.W., Norton, B., Baskauf, S.J., et al. (2023). Camtrap DP: an open standard for the FAIR exchange and archiving of camera trap data. Remote Sensing in Ecology and Conservation, 10(3), 283-295.

Desmet, P., Govaert, S., Huybrechts, P., Oldoni, D. (2024). camtrapdp: Read and Manipulate Camera Trap Data Packages. R package version 0.3.1. https://CRAN.R-project.org/package=camtrapdp

See Also

read_camtrapdp in the 'camtrapdp' package for reading Camtrap DP data check_camtrapdp in the 'camtrapdp' package for validating Camtrap DP data

Examples

Run this code
if (FALSE) {
# Read a Camtrap DP dataset
camtrap_data <- readcamtrapDP(
  deployments_file = "path/to/deployments.csv",
  media_file = "path/to/media.csv",
  observations_file = "path/to/observations.csv",
  datapackage_file = "path/to/datapackage.json"
)

# alternatively, set the working directory only
setwd("path/to/camtrapdp_data")
camtrap_data <- readcamtrapDP()   # uses default file names


# Extract components
ct_table <- camtrap_data$CTtable
record_table <- camtrap_data$recordTable
metadata <- camtrap_data$metadata

}

Run the code above in your browser using DataLab