Learn R Programming

secr (version 2.4.0)

reduce.capthist: Combine Occasions Or Convert Detector Types

Description

Combine columns (occasions) in a capthist object to create a new data set, possibly converting between detector types

Usage

## S3 method for class 'capthist':
reduce(object, columns = NULL, outputdetector = 
    detector(traps(object)), select='last', dropunused = TRUE,
    verify = TRUE, sessions = NULL, by = 1, ...)

Arguments

object
capthist object
columns
list in which each component is a vector of subscripts for occasions to be pooled
outputdetector
character value giving detector type for output
select
character value for method to resolve conflicts
dropunused
logical, if TRUE any never-used detectors are dropped
verify
logical, if TRUE the verify function is applied to the output
sessions
vector of session indices or names (optional)
by
number of old occasions in each new occasion
...
other arguments (not used currently)

Value

  • An object of class capthist with number of columns equal to length(occasions). The detector type is inherited from object unless a new type is specified with the argument outputdetector.

Details

The first component of columns defines the columns of object for new occasion 1, the second for new occasion 2, etc. If columns is NULL then all occasions are output. Subscripts in a component of columns that do not match an occasion in the input are ignored. When the output detector is one of the trap types (`single', `multi'), reducing capture occasions can result in locational ambiguity for individuals caught on more than one occasion, and for single-catch traps there may also be conflicts between individuals at the same trap. The method for resolving conflicts among `multi' detectors is determined by select which should be one of `first', `last' or `random'. With `single' detectors select is ignored and the method is: first, randomly select* one trap per animal per day; second, randomly select* one animal per trap per day; third, when collapsing multiple days use the first capture, if any, in each trap. Usage data in the traps attribute are also pooled if present; a trap is considered `used' on a pooled occasion if it was used on any contributing occasion. * i.e., in the case of a single capture, use that capture; in the case of multiple `competing' captures draw one at random. If columns is not provided then old occasions are grouped into new occasions as indicated by the by argument. For example, if there are 15 old occasions and by = 5 then new occasions will be formed from occasions 1:5, 6:10, and 11:15. A warning is given when the number of old occasions is not a multiple of by as then the final new occasion will comprise fewer old occasions. A special use of the by argument is to combine all occasions into one for each session in a multi-session dataset. This is done by setting by = "all".

See Also

capthist, subset.capthist

Examples

Run this code
tempcapt <- sim.capthist (make.grid(nx = 6, ny = 6), nocc = 6)
class(tempcapt)

pooled.tempcapt <- reduce(tempcapt, col = list(1,2:3,4:6))
summary (pooled.tempcapt)

pooled.tempcapt2 <- reduce(tempcapt, by = 2)
summary (pooled.tempcapt2)

## collapse multi-session dataset to single-session 'open population'
onesess <- join(reduce(ovenCH, by = "all"))
summary(onesess)

Run the code above in your browser using DataLab