utils: Various helper functions

Helper functionsR Documentation

Various helper functions

Description

cleanCH removes histories without any capture (ie, all-zero rows) from a capture-recapture matrix.

rmFirst removes the first capture in each row of a capture history matrix, replacing it with zero.

zKnown takes a capture history and returns a matching matrix with 1 where the individual is know to be alive (ie, between the first and last capture) and NA elsewhere.

zInit takes a capture history and returns a matching matrix with 1 after the occasion of first capture and NA elsewhere.

zInitDR takes a dead-recovery capture history and returns a matching matrix with 1 after the occasion of first capture until the recovery occasion and 0 subsequently; NA elsewhere.

getFirst calculates the occasion of first capture in a capture history matrix.

Usage

cleanCH(ch)
zKnown(ch)
zInit(ch)
zInitDR(chDR)
rmFirst(x)
getFirst(x)

Arguments

ch

an individuals x time matrix with capture histories.

chDR

an individuals x time matrix with dead recovery capture histories: 1 indicates initial capture or dead recovery, 0 otherwise.

x

an individuals x time matrix with capture histories, or a vector of capture/noncapture data, typically 1 row of a capture history.

Value

cleanCH, zKnown, zInit, zInitDR and rmFirst return the modified capture history matrix.

getFirst returns the occasion of first capture, NA if no capture recorded for an individual.

Author(s)

Michael Schaub, Marc Kéry, Mike Meredith


IPMbook documentation built on Aug. 22, 2023, 1:07 a.m.