verify: Check SECR Data

verifyR Documentation

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

## Default S3 method:
verify(object, report, ...)
## S3 method for class 'traps'
verify(object, report = 2, ...)
## S3 method for class 'capthist'
verify(object, report = 2, tol = 0.01, ...)
## S3 method for class 'mask'
verify(object, report = 2, ...)

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 (not required for unmarked data, or for telemetry type ‘marking’ with sightings and no animals)

  4. Missing values not allowed in capthist

  5. Signal detector signal(s) less than threshold or invalid threshold; ‘signal’ attribute does not match detections

  6. Live detection(s) after reported dead

  7. Empty detection histories (except concurrent or marking telemetry and all-sighting data)

  8. More than one detection per detector per occasion at binary detector(s) (‘single’, ‘multi’, ‘proximity’, ‘polygonX’, ‘transectX’, ‘signal’ or ‘signalnoise’)

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

  10. Animal detected at more than one detector on an occasion (‘multi’, ‘polygonX’ or ‘transectX’ detectors)

  11. Counts less than zero (‘count’, ‘polygon’ or ‘transect’ detectors)

  12. Number of rows in ‘traps’ object not compatible with reported detections

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

  14. Number of occasions in usage matrix differs from capthist

  15. Detections at unused detectors

  16. Number of coordinates does not match number of detections (‘polygon’, ‘polygonX’, ‘transect’ or ‘transectX’ detectors)

  17. Coordinates of detection(s) outside polygons (‘polygon’ or ‘polygonX’ detectors)

  18. Coordinates of detection(s) do not lie on any transect (‘transect’ or ‘transectX’ detectors)

  19. Row names (animal identifiers) not unique, or missing

  20. Inconsistencies in resighting data: dimensions of ‘markocc’, ‘Tu’ or ‘Tm’ incompatible with the capthist, or counts negative or not whole numbers; sightings at unused detectors; new animals on a sighting-only occasion; sightings on a marking-only occasion

  21. Inconsistencies in telemetry data: occasions with no detections; number or names of telemetered animals, or number of locations, not matching the detections; for ‘dependent’ telemetry, animals with an all-zero detection history; for ‘marking’ telemetry, a detection history without telemetry locations or a telemetered animal without a detection history; for ‘independent’ telemetry, non-zero detection histories

  22. Invalid non-target data

For multi-session data each session is checked separately, and the following checks are also made across sessions: levels of factor covariate(s) differ between sessions (a warning, not an error; see shareFactorLevels); individual covariates present in some sessions and NULL in others (stops with an error).

verify.traps

  1. Missing detector coordinates not allowed

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

  3. Invalid combination of detector types (a mixture of types is allowed only for point detectors – ‘single’, ‘multi’, ‘proximity’, ‘count’, ‘signal’, ‘signalnoise’, ‘unmarked’ or ‘presence’ – with or without ‘telemetry’)

  4. Number of detectors in usage matrix differs from expected

  5. Number of occasions in usage matrix differs from the length of the detector attribute

  6. Occasions with no used detectors

  7. Number of occasions in markocc differs from usage matrix (resighting data)

  8. Values in markocc other than -2, -1, 0 or 1 (resighting data)

  9. Polygons overlap, or no search area specified (‘polygon’ or ‘polygonX’ detectors)

  10. PolyID missing or not factor (‘polygon’ or ‘polygonX’ detectors)

  11. Polygon concave in east-west direction (‘polygon’ or ‘polygonX’ detectors)

  12. More than one row in the notional traps object for telemetry (telemetry-only data)

For multi-session data each session is checked separately, and the following checks are also made across sessions: levels of factor trap covariate(s) differ between sessions (a warning); trap covariates present in some sessions and NULL in others (stops with an error).

verify.mask

  1. Valid x and y coordinates

  2. Number of rows in covariates dataframe differs from expected

For multi-session data each session is checked separately, and levels of factor mask covariate(s) are also compared between sessions (a warning).

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

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. For a single-session capthist the list also has components trapcheck (the result of verify.traps) and captcheck (a list of logical values, one for each group of checks on the detections), and, if there are detections at unused detectors, detections.at.unused.detectors. For a traps object the components include the logical result of each check. The value is returned invisibly.

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

See Also

capthist, make.marking, secr.fit, shareFactorLevels

Examples


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)


secr documentation built on Nov. 25, 2026, 9:06 a.m.