Learn R Programming

secr (version 4.6.10)

verify: Check SECR Data

Description

Check that the data and attributes of an object are internally consistent to avoid crashing functions such as secr.fit

Usage

# S3 method for default
verify(object, report, ...)
# S3 method for traps
verify(object, report = 2, ...)
# S3 method for capthist
verify(object, report = 2, tol = 0.01, ...)
# S3 method for mask
verify(object, report = 2, ...)

Value

A list with the component errors, a logical value indicating whether any errors were found. If object contains multi-session data then session-specific results are contained in a further list component bysession.

Full reporting is the same as `errors only' except that a message is posted when no errors are found.

Arguments

object

an object of class `traps', `capthist' or `mask'

report

integer code for level of reporting to the console. 0 = no report, 1 = errors only, 2 = full.

tol

numeric tolerance for deviations from transect line (m)

...

other arguments (not used)

Details

Checks are performed specific to the class of `object'. The default method is called when no specific method is available (i.e. class not `traps', `capthist' or `mask'), and does not perform any checks.

verify.capthist

  1. No `traps' component

  2. Invalid `traps' component reported by verify.traps

  3. No live detections

  4. Missing values not allowed in capthist

  5. Live detection(s) after reported dead

  6. Empty detection histories (except concurrent telemetry and all-sighting data)

  7. More than one capture in single-catch trap(s)

  8. More than one detection per detector per occasion at proximity detector(s)

  9. Signal detector signal(s) less than threshold or invalid threshold

  10. Number of rows in `traps' object not compatible with reported detections

  11. Number of rows in dataframe of individual covariates differs from capthist

  12. Number of occasions in usage matrix differs from capthist

  13. Detections at unused detectors

  14. Number of coordinates does not match number of detections (`polygon', `polygonX', `transect' or `transectX' detectors)

  15. Coordinates of detection(s) outside polygons (`polygon' or `polygonX' detectors)

  16. Coordinates of detection(s) do not lie on any transect (`transect' or `transectX' detectors)

  17. Row names (animal identifiers) not unique

  18. Levels of factor covariate(s) differ between sessions

verify.traps

  1. Missing detector coordinates not allowed

  2. Number of rows in dataframe of detector covariates differs from expected

  3. Number of detectors in usage matrix differs from expected

  4. Occasions with no used detectors

  5. Polygons overlap

  6. Polygons concave east-west (`polygon' detectors)

  7. PolyID missing or not factor

  8. Polygon detector is concave in east-west direction

  9. Levels of factor trap covariate(s) differ between sessions

verify.mask

  1. Valid x and y coordinates

  2. Number of rows in covariates dataframe differs from expected

  3. Levels of factor mask covariate(s) differ between sessions

Earlier errors may mask later errors: fix & re-run.

See Also

capthist, secr.fit, shareFactorLevels

Examples

Run this code

verify(captdata)

## create null (complete) usage matrix, and mess it up
temptraps <- make.grid()
usage(temptraps) <- matrix(1, nr = nrow(temptraps), nc = 5)
usage(temptraps)[,5] <- 0
verify (temptraps)

## create mask, and mess it up
tempmask <- make.mask(temptraps)
verify(tempmask)
tempmask[1,1] <- NA
verify(tempmask)

Run the code above in your browser using DataLab