Overview

camtrapR can help with data exploration by creating maps of observed species richness and the number of independent detections by species. It can also plot single-species and two-species diel activity data. In addition, a survey report summarising camera trap station operation and species records can be created easily. The usage of these functions will be demonstrated using the sample data set included in the package.

In creating the plots and the report, the species record table and the camera trap station information table are combined. Therefore, both are required as function input (more details in the vignette on “Image organisation and species/individual identification”).

Species presence maps

The function detectionMaps can generate maps of observed species richness (number of different species recorded at stations) and maps showing the number of observations by species. It uses the record table produced by recordTable and the camera trap station table as input. Note that the examples are not particularly pretty because of the low number of records used in the sample data set.

Number of records by species

Maps of the number of independent detections of the observed species can be generated just as easily. Normally, maps for all species will be created at once. Here, to avoid cluttering the vignette, we look at one species only. This is achieved via the argument speciesToShow. Arguments richnessPlot and speciesPlots are changed compared to the observed species richness plot above. It is also possible to set both arguments to TRUE or FALSE.

The number of independent observations depends on the argument minDeltaTime in the recordTable function.

Shapefile export

Function detectionMaps comes with 4 arguments that allow for and control creation of ESRI shapefile for use in GIS software: writeShapefile, shapefileName, shapefileDirectory and shapefileProjection. The resulting shapefile will show stations as point features (as the map above), with coordinates, total species number and number of observations per species in the attribute table. The shapefile attribute table is identical to the resulting data.frame of the detectionMaps function.

The following example demonstrates the creation of a shapefile using detectionMaps. Please note that for demonstration the shapefile is saved to a temporary directory, which makes no sense in real data and must be changed by the user. The argument shapefileProjection must be a valid argument to the function CRS from the package sp, i.e., a PROJ.4 string. These can be found under http://spatialreference.org/. There, find the projection your coordinates are in, click on “Proj4” and copy the text. In this example, it is a projected coordinate system, UTM 50N with the WGS84 ellipsoid. Its PROJ.4 string is "+proj=utm +zone=50 +ellps=WGS84 +datum=WGS84 +units=m +no_defs". Because it is so widespread, here’s the PROJ4 string for standard Lat/Long coordinates using the WGS84 ellipsoid (a standard used by most GPS devices): "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs".

# the output of detectionMaps is used as shapefile attribute table. Therefore, they are identical:all(shapefileTest@data ==Mapstest3)

## [1] TRUE

Making and using a SpatialPointsDataFrame

The data frame that detectionMaps returns can be turned into a SpatialPointsDataFrame as defined in the package sp. SpatialPointsDataFrames can be used for spatial analyses and queries in R, e.g. for extracting data from raster layers such as elevation maps.

This is how it works. We use the output of detectionMaps created above and make a SpatialPointsDataFrame. Afterwards, a sample raster is created, plotted together with the points and the values are extracted.

The same procedure also works with the camera trap station information table instead of the detectionMaps output.

Visualising species activity data

Four different functions are provided to plot single-species and two-species activity patterns. Activity data are visualised using the time of day records were taken while ignoring the date. Record times are read from the record table created by recordTable. The criterion for temporal independence between records in the function recordTable, minDeltaTime, will affect the results of the activity plots. Imagine you make recordTable return all records by setting minDeltaTime = 0 and you then plot activity of some species that loves to perform in front of cameras (e.g. Great Argus pheasants in Borneo), resuting in hundreds of images. The representation of activity will be biased towards the times the species happened to perform in front of your cameras. Likewise, setting cameras to shoot sequences of several images per trigger event and then returning all images will cause biased representations. Therefore, it is wise to set minDeltaTime to some higher number, e.g. 60 (minutes).

If desired, all functions can save the plots as png files by setting argument writePNG = TRUE.

Single-species activity plots

Single-species activity can be plotted in 3 different ways using 3 different functions:

activityDensity: kernel density estimation

activityHistogram: histogram of hourly activity

activityRadial: radial plot of hourly activity

In all three, users can either plot activity of one focal species (by setting argument allSpecies = FALSE) or of all recorded species at once (by setting argument allSpecies = TRUE). If desired, plots can be saved as png files in a user-defined location automatically (arguments writePNG and plotDirectory). Note that the examples are not particularly pretty because of the low number of records used in the sample data set.

Two-species activity plots

Two-species activity overlaps can be plotted in addition to single-species activity plots. It is the overlap between two single-species kernel density estimations. The functions overlapPlot and overlapEst from the overlap package are used for that purpose. The overlap coefficient shown in the plot is Dhat1 from overlapEst.

The list elements can be accessed individually like this: reportTest[[1]] or like this: reportTest$survey_dates.

Some of the arguments need further explanations. CTHasProblems is used to tell camtrapR whether to look for columns specifying periods of malfunctioning in CTtable (e.g. ‘Problem1_from’ and ‘Problem1_to’). If there was more than one camera per station cameraCol specifies the columns containing camera IDs . Not setting it will cause camtrapR to assume there was 1 camera per station, biasing the trap day calculation. sinkpath can optionally be a directory in which the function will save the output as a txt file.

# reportTest[[5]] is identical to reportTest[[4]] except for the fact that it contains unobserved species with n_events = 0

Survey summary report zip file

A zip file containing the output of surveyReport, the input tables, activity plots, detection maps and a prepared R script can be created by setting makezip = TRUE. The zip file is relatively small and can easily be used for data sharing with colleagues.

Data archiving

The tables provided by the function surveyReport together with the camera station table and the record table provide key information about surveys. These data can be used for archiving survey data in online repositories such as the Knowledge Network for Biocomplexity (KNB), a DataONE member node (https://www.dataone.org). To make these survey data understandable and usable for everyone, they need to be described thoroughly by metadata. Because of the amount of metadata needed to adequately describe the survey data and the technical requirement involved, we recommend using external software (e.g. Morpho) for annotating data generated with camtrapR before upload to repositories.