subset.traps {secr} | R Documentation

## Subset traps Object

### Description

Retain selected rows of a traps object.

### Usage

    ## S3 method for class 'traps':
    subset(x, subset, ...)
    ## S3 method for class 'traps':
    split(x, f, drop = FALSE, prefix = 'S', ...)

### Arguments

`x` | `traps` object
`subset` | vector to subscript the rows of `x`
`...` | arguments passed to other functions
`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

### Details

The subscripts in `subset` may be of type integer, character or logical as described in `Extract`.

`split` generates a list in which each component is a `traps` object. Each component corresponds to a level of `f`. The argument 'x' of `split` cannot be a list.

### Value

An object of class `traps` with only the requested subset of rows. Subsetting is applied to `usage` and `covariates` attributes if these are present.

### Author(s)

Murray Efford murray.efford@otago.ac.nz

### See Also

`traps`, `rbind.traps`

### Examples

    ## odd-numbered traps only, using modulo operator
    temptrap <- make.grid(nx = 7, ny = 7)
    t2 <- subset(temptrap, as.logical(1:nrow(temptrap) %% 2))
    plot(t2)

[Package secr version 1.3.0 Index]