capthist object for analysis in capthist object may also be exported in these formats for use
in DENSITY (Efford 2009). read.capthist inputs data from text
files and constructs a capthist object in one step using the
functions read.traps and make.capthist.read.capthist(captfile, trapfile, detector = "multi", fmt = "trapID",
noccasions = NULL, covnames = NULL, verify = TRUE, ...)
write.capthist(object, filestem = deparse(substitute(object)),
sess = "1", ndec = 2, ...)verifyread.table, write.table and
count.fieldscapthist object with the captures and trap locations to exportread.capthist
captfile should record one detection on each line. A detection
comprises a session identifier, animal identifier, occasion number (1,
2,...,S where S is the number of occasions), and a
detector identifier (fmt = 'trapID') or X- and Y-coordinates
(fmt = 'XY'). Each line of trapfile has a detector
identifier and its X- and Y-coordinates. In either file type the
identifiers (labels) may be numeric or alphanumeric values. Values
should be separated by blanks or tabs unless (i) the file name ends in
`.csv' or (ii) sep = ',' is passed in ..., in which case commas
are assumed. Blank lines and any text after `#' are ignored. For further
details see make.capthist
and `Data formats' in the help for DENSITY.
The noccasions argument is needed only if there were no
detections on the final occasion; it may be a positive integer (constant
across all sessions) or a vector of positive integers, one for each
session. covnames is needed only when captfile includes
individual covariates. Values of noccasions and covnames
are passed directly to make.capthist.
A session identifier is required even for single-session
capture data. In the case of data from multiple sessions,
trapfile may be a vector of file names, one for each session.
Additional data may be coded as for DENSITY. Specifically,
captfile may include extra columns of individual covariates, and
trapfile may code varying usage of each detector over occasions
and detector covariates. [These features have yet to be thoroughly
tested in 1.4.0].
write.capthist
For a single-session analysis, DENSITY requires one text file of
capture data and one text file with detector coordinates (the `trap
layout' file). write.capthist constructs names for these files
by appending `capt.txt' and `trap.txt' to filestem which
defaults to the name of the capthist object. If filestem is
empty then output goes to the console.
If object contains multiple sessions with differing
traps then a separate trap layout file is exported for each
session and each file name includes the session name. All capture data
are exported to one file regardless of the number of sessions. The
DENSITY format used is `TrapID'.
Existing text files will be replaced without warning. In the case of a
multi-session capthist file, session names are taken from
object rather than sess. Session names are truncated to
17 characters with blanks and commas removed.
To export data in comma-delimited (`.csv') format, pass sep =
',' in .... The resulting files have extension `.csv' rather than
`.txt' and may be opened with spreadsheet software.read.traps, make.capthist,
write.captures, write.traps, read.tabledata(ovenbird)
write.capthist(ovenCH)Run the code above in your browser using DataLab