Learn R Programming

camtrapR (version 0.99.0)

cameraOperation: Create a camera trap station operability matrix

Description

Construct a matrix of daily camera trap station operability for use in detectionHistory and spatialDetectionHistory, where it is needed for calculating trapping effort per occasion. If several cameras were deployed per station, the matrix can contain camera- or station-specific trap operation information.

Usage

cameraOperation(CTtable, 
  stationCol, 
  cameraCol, 
  setupCol, 
  retrievalCol, 
  hasProblems = FALSE,
  byCamera, 
  allCamsOn, 
  camerasIndependent,
  dateFormat = "%Y-%m-%d", 
  writecsv = FALSE, 
  outDir
)

Arguments

CTtable
data.frame containing information about location and trapping period of camera trap stations
stationCol
character. name of the column specifying Station ID in CTtable
cameraCol
character. name of the column specifying Camera ID in CTtable (optional). If empty, 1 camera per station is assumed.
setupCol
character. name of the column containing camera setup dates in CTtable
retrievalCol
character. name of the column containing camera retrieval dates in CTtable
hasProblems
logical. If TRUE, function will look for columns specifying malfunction periods in CTtable (naming convention: ProblemX_from and ProblemX_to, where X is a number)
byCamera
logical. If TRUE, camera operability matrix is computed by camera, not by station (requires cameraCol)
allCamsOn
logical. If TRUE, all cameras of a station need to be operational for a station to be operational (only relevant if byCamera is FALSE). Output values will be 1/0/NA only (all cameras at a station operational/ at least 1 camera not operational
camerasIndependent
logical. Return number of active camera traps by station? Only if byCamera is FALSE and allCamsOn is FALSE. If camerasIndependent is TRUE, output values will the number of operational cameras at a station. If c
dateFormat
character. The format of columns setupCol and retrievalCol. Should be interpretable by as.Date
writecsv
logical. Should the camera operability matrix be saved as a .csv?
outDir
character. Directory into which csv is saved

Value

  • A matrix. Row names indicate Station IDs (camera ID if byCamera = TRUE), column names are dates. Legend: NA: camera(s) not set up, 0: camera(s) not operational, 1 (or higher): number of operational camera(s) or an indicator for whether the station was operational (depending on camerasIndependent and allCamsOn)

Details

cameraCol is NULL by default. The function then assumes there was 1 camera per station CTtable. In more than 1 camera was deployed per station, cameraCol needs to be specified to identify individual cameras within a station. dateFormat defaults to "YYYY-MM-DD", e.g. "2014-10-31". See strptime for formatting options. If hasProblems is TRUE, the function tries to find columns ProblemX_from and ProblemX_to in CTtable. X is a consecutive number from 1 to n, specifying periods in which a camera or station was not operational. If hasProblems is FALSE, cameras are assumed to have been operational uninterruptedly from setup to retrieval (see camtraps for details). allCamsOn only has an effect if there was more than 1 camera at a station. If TRUE, for the station to be considered operational, all cameras at a station need to be operational. If FALSE, at least 1 active camera renders the station operational. Argument camerasIndependent defines if cameras record animals independently (it thus only has an effect if there was more than 1 camera at a station). This is the case if an observation at one camera does not increase the probability for detection at another camera (cameras face different trails at a distance of one another). Non-independence occurs if an animal is likely to trigger both camers (as would be the case with 2 cameras facing each other). If camerasIndependent is TRUE, 2 active cameras at a station will result in a station operation value of 2 in the resulting matrix, i.e., 2 independent trap days at 1 station and day. If camerasIndependent is FALSE, 2 active cameras will return value 1, i.e., 1 trap night at 1 station per day.

Examples

Run this code
data(camtraps)

# no problems/malfunction
camop_no_problem <- cameraOperation(CTtable      = camtraps,
                                    stationCol   = "Station",
                                    setupCol     = "Setup_date",
                                    retrievalCol = "Retrieval_date",
                                    writecsv     = FALSE,
                                    hasProblems  = FALSE,
                                    dateFormat   = "%d/%m/%Y"
)

# with problems/malfunction
camop_problem <- cameraOperation(CTtable      = camtraps,
                                 stationCol   = "Station",
                                 setupCol     = "Setup_date",
                                 retrievalCol = "Retrieval_date",
                                 writecsv     = FALSE,
                                 hasProblems  = TRUE,
                                 dateFormat   = "%d/%m/%Y"
)

camop_no_problem
camop_problem

Run the code above in your browser using DataLab