subset.capthist {secr}R Documentation

Subset or Split capthist Object

Description

Create a new capthist object or list of objects by selecting rows (individuals), columns (occasions) and traps from an existing capthist object.

Usage

## S3 method for class 'capthist':
subset(x, subset = NULL, occasions = NULL, traps = NULL,
    sessions = NULL, cutval = NULL, dropnull = TRUE, dropunused = TRUE, 
    renumber = FALSE, ...)
## S3 method for class 'capthist':
split(x, f, drop = FALSE, prefix = 'S', ...)

Arguments

x object of class capthist
subset vector of subscripts to select rows (individuals)
occasions vector of subscripts to select columns (occasions)
traps vector of subscripts to select detectors (traps)
sessions vector of subscripts to select sessions
cutval new threshold for signal strength
dropnull logical for whether null (all-zero) capture histories should be dropped
dropunused logical for whether never-used detectors should be dropped
renumber logical for whether row.names should be replaced with sequence number in new capthist
f factor or object that may be coerced to a factor
drop logical indicating if levels that do not occur should be dropped (if f is a factor)
prefix a character prefix to be used for component names when values of f are numeric
... other arguments (not used currently)

Details

Subscript vectors may be either logical (length equal to the relevant dimension of x) or integer-valued. Subsetting is applied to attributes (e.g. covariates, traps) as appropriate. The default action is to include all rows, columns and traps if the relevant argument is omitted.

When traps is provided, detections at other detectors are set to zero, as if the detector had not been used, and the corresponding rows are removed from traps. If the detector type is 'proximity' then selecting traps also reduces the third dimension of the capthist array.

split generates a list in which each component is a capthist object. Each component corresponds to a level of f.

To combine (pool) occasions use reduce.capthist. There is no equivalent of unlist for lists of capthist objects.

Value

capthist object with the requested subset of observations, or a list of such objects (i.e., a multi-session capthist object). List input results in list output, except when a single session is selected.

Author(s)

Murray Efford murray.efford@otago.ac.nz

See Also

capthist, rbind.capthist, reduce.capthist

Examples

tempcapt <- sim.capthist (make.grid(nx=6, ny=6), nocc=6)
summary(subset(tempcapt, occ=c(1,3,5)))

## Consider 'proximity' detections at a random subset of detectors
## This would not make sense for 'multi' detectors, as the 
## excluded detectors influence detection probabilities in 
## sim.capthist.

tempcapt2 <- sim.capthist (make.grid(nx = 6, ny = 6, 
    detector = 'proximity'), nocc = 6)
tempcapt3 <- subset(tempcapt2, traps = sample(1:36, 18, 
    replace=FALSE))
summary(tempcapt3)
plot(tempcapt3)

split (tempcapt2, f = sample (c('A','B'), nrow(tempcapt2), 
    replace = TRUE))


[Package secr version 1.3.0 Index]