make.capthist
is the most flexible way to prepare data for
secr.fit
. See read.capthist
for a more streamlined
way to read data from text files for common detector types. Each row of
the input data frame captures
represents a detection on one
occasion. The capture data frame may be formed from a text file with
read.table
.
Input formats are based on the Density software (Efford 2012; see also
secr-datainput.pdf). If fmt =
"XY"
the required fields are (session, ID, occasion, x, y) in that
order. If fmt = "trapID"
the required fields are (session, ID,
occasion, trap), where trap
is the numeric index of the relevant
detector in traps
. session
and ID
may be
character-, vector- or factor-valued; other required fields are
numeric. Fields are matched by position (column number), not by
name. Columns after the required fields are interpreted as individual
covariates that may be continuous (e.g., size) or categorical (e.g.,
age, sex).
If captures
has data from multiple sessions then traps
may
be either a list of traps
objects, one per session, or a single
traps
object that is assumed to apply throughout. Similarly,
noccasions
may be a vector specifying the number of occasions in
each session.
Covariates are assumed constant for each individual; the first
non-missing value is used. The length of covnames
should equal the
number of covariate fields in captures
.
bysession
takes effect when the same individual is detected in
two or more sessions: TRUE results in one capture history per session,
FALSE has the effect of generating a single capture history (this is not
appropriate for the models currently provided in secr).
Deaths are coded as negative values in the occasion field of
captures
. Occasions should be numbered 1, 2, ..., noccasions. By
default, the number of occasions is the maximum value of `occasion' in
captures
.
Signal strengths may be provided in the fifth (fmt = trapID) or sixth
(fmt = XY) columns. Detections with signal strength missing (NA) or
below `cutval' are discarded.
A session may result in no detections. In this case a null line is
included in captures
using the animal ID field given by
noncapt
, the maximum occasion number, and any trapID (e.g. "sess1
NONE 5 1" for a 5-occasion session) (or equivalently "sess1 NONE 5 10
10" for fmt = XY).
Nonspatial data (Session, AnimalID, Occasion and possibly individual
covariates) may be entered by omitting the `traps' argument or setting
it to NULL.