Camtrapdp is an R package to read and manipulate Camera Trap Data Packages (Camtrap DP). Camtrap DP is a data exchange format for camera trap data. With camtrapdp you can read, filter and transform data (including to Darwin Core) before further analysis in e.g. camtraptor or camtrapR.
To get started, see:
- Function reference: overview of all functions.
Installation
Install the latest released version from CRAN:
install.packages("camtrapdp")
Or the development version from GitHub:
# install.packages("devtools")
devtools::install_github("inbo/camtrapdp")
Usage
With camtrapdp you can read a Camtrap DP dataset into your R environment:
library(camtrapdp)
file <- "https://raw.githubusercontent.com/tdwg/camtrap-dp/1.0/example/datapackage.json"
x <- read_camtrapdp(file)
x
#> A Camera Trap Data Package with 3 tables:
#> • deployments: 4 rows
#> • media: 423 rows
#> • observations: 549 rows
#>
#> And 1 additional resource:
#> • individuals
#> Use `unclass()` to print the Data Package as a list.
read_camtrapdp()
will automatically upgrade an older version of Camtrap DP to the latest version. It will also make the data easier to use, by assigning taxonomic information (found in the metadata) to the observations and eventID
s (found in the observations) to the media.
To access the data, use one of the accessor functions like locations()
:
locations(x)
#> # A tibble: 4 × 5
#> locationID locationName latitude longitude coordinateUncertainty
#> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 e254a13c B_HS_val 2_processiepark 51.5 4.77 187
#> 2 2df5259b B_DL_val 5_beek kleine vi… 51.2 5.66 187
#> 3 ff1535c0 B_DL_val 3_dikke boom 51.2 5.66 187
#> 4 ce943ced B_DM_val 4_'t WAD 50.7 4.01 187
You can also filter data with one of the filter functions, which automatically filter the related data. For example, here we filter observations on scientific name(s) and return the associated events in that subset:
x %>%
filter_observations(
scientificName %in% c("Martes foina", "Mustela putorius")
) %>%
events()
#> # A tibble: 4 × 4
#> deploymentID eventID eventStart eventEnd
#> <chr> <chr> <dttm> <dttm>
#> 1 577b543a 976129e2 2020-06-19 22:31:51 2020-06-19 22:31:56
#> 2 577b543a b4b39b00 2020-06-23 23:33:53 2020-06-23 23:33:58
#> 3 577b543a 5be4f4ed 2020-06-28 22:01:12 2020-06-28 22:01:18
#> 4 577b543a a60816f2 2020-06-28 23:33:16 2020-06-28 23:33:22
For more functionality, see the function reference.
GBIF pipeline
The Global Biodiversity Information Facility (GBIF) uses camtrapdp to process Camera Trap Data Packages published with the Integrated Publishing Toolkit (IPT). Datasets are first read with read_camtrapdp()
and then converted to Darwin Core with write_dwc()
and EML with write_eml()
. See the Camtrap DP pipeline repository for details.
Meta
- We welcome contributions including bug reports.
- License: MIT
- Get citation information for camtrapdp in R doing
citation("camtrapdp")
. - Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.