Learn R Programming

secr (version 4.6.9)

make.traps: Build Detector Array

Description

Construct a rectangular array of detectors (trapping grid) or a circle of detectors or a polygonal search area.

Usage

make.grid(nx = 6, ny = 6, spacex = 20, spacey = spacex, spacing = NULL,
    detector = "multi", originxy = c(0,0), hollow = FALSE, ID = "alphay", 
    leadingzero = TRUE, markocc = NULL)

make.circle (n = 20, radius = 100, spacing = NULL, detector = "multi", originxy = c(0,0), IDclockwise = TRUE, leadingzero = TRUE, markocc = NULL)

make.poly (polylist = NULL, x = c(-50,-50,50,50), y = c(-50,50,50,-50), exclusive = FALSE, verify = TRUE)

make.transect (transectlist = NULL, x = c(-50,-50,50,50), y = c(-50,50,50,-50), exclusive = FALSE)

make.telemetry (xy = c(0,0))

Value

An object of class traps comprising a data frame of x- and y-coordinates, the detector type ("single", "multi", or "proximity" etc.), and possibly other attributes.

Arguments

nx

number of columns of detectors

ny

number of rows of detectors

spacex

distance between detectors in `x' direction (nominally in metres)

spacey

distance between detectors in `y' direction (nominally in metres)

spacing

distance between detectors (x and y directions)

detector

character value for detector type - "single", "multi" etc.

originxy

vector origin for x-y coordinates

hollow

logical for hollow grid

ID

character string to control row names

leadingzero

logical; if TRUE numeric rownames are padded with leading zeros

markocc

integer vector of marking or sighting codes; see markocc

n

number of detectors

radius

radius of circle (nominally in metres)

IDclockwise

logical for numbering of detectors

polylist

list of dataframes with coordinates for polygons

transectlist

list of dataframes with coordinates for transects

x

x coordinates of vertices

y

y coordinates of vertices

exclusive

logical; if TRUE animal can be detected only once per occasion

verify

logical if TRUE then the resulting traps object is checked with verify

xy

vector with coordinates of arbitrary point (e.g., centroid of fixes)

Details

make.grid generates coordinates for nx.ny traps at separations spacex and spacey. If spacing is specified it replaces both spacex and spacey. The bottom-left (southwest) corner is at originxy. For a hollow grid, only detectors on the perimeter are retained. By default, identifiers are constructed from a letter code for grid rows and an integer value for grid columns ("A1", "A2",...). `Hollow' grids are always numbered clockwise in sequence from the bottom-left corner. Other values of ID have the following effects:

IDEffect
numxcolumn-dominant numeric sequence
numyrow-dominant numeric sequence
numxbcolumn-dominant boustrophedonical numeric sequence (try it!)
numybrow-dominant boustrophedonical numeric sequence
alphaxcolumn-dominant alphanumeric
alphayrow-dominant alphanumeric
xycombine column (x) and row(y) numbers

`xy' adds leading zeros as needed to give a string of constant length with no blanks.

make.circle generates coordinates for n traps in a circle centred on originxy. If spacing is specified then it overrides the radius setting; the radius is adjusted to provide the requested straightline distance between adjacent detectors. Traps are numbered from the trap due east of the origin, either clockwise or anticlockwise as set by IDclockwise.

Polygon vertices may be specified with x and y in the case of a single polygon, or as polylist for one or more polygons. Each component of polylist is a dataframe with columns `x' and `y'. polylist takes precedence. make.poly automatically closes the polygon by repeating the first vertex if the first and last vertices differ.

Transects are defined by a sequence of vertices as for polygons, except that they are not closed.

make.telemetry builds a simple traps object for the 'telemetry' detector type. The attribute 'telemetrytype' is set to "independent".

Specialised functions for arrays using a triangular grid are described separately (make.tri, clip.hex).

References

Efford, M. G. (2012) DENSITY 5.0: software for spatially explicit capture--recapture. Department of Mathematics and Statistics, University of Otago, Dunedin, New Zealand. https://www.otago.ac.nz/density/.

Efford, M. G., Borchers D. L. and Byrom, A. E. (2009) Density estimation by spatially explicit capture-recapture: likelihood-based methods. In: D. L. Thomson, E. G. Cooch and M. J. Conroy (eds) Modeling Demographic Processes in Marked Populations. Springer, New York. Pp. 255--269.

See Also

read.traps,detector, trap.builder,make.systematic, print.traps, plot.traps, traps, make.tri, addTelemetry

Examples

Run this code
demo.traps <- make.grid()
plot(demo.traps)

## compare numbering schemes
par (mfrow = c(2,4), mar = c(1,1,1,1), xpd = TRUE)
for (id in c("numx", "numy", "alphax", "alphay", "numxb", 
    "numyb"))
{
    temptrap <- make.grid(nx = 7, ny = 5, ID = id)
    plot (temptrap, border = 10, label = TRUE, offset = 7, 
        gridl = FALSE)
}

temptrap <- make.grid(nx = 7, ny = 5, hollow = TRUE)
plot (temptrap, border = 10, label = TRUE, gridl = FALSE)

plot(make.circle(n = 20, spacing = 30), label = TRUE, offset = 9)
summary(make.circle(n = 20, spacing = 30))

## jitter locations randomly within grid square
## and plot over `mask'
# see also ?gridCells

tr0 <- tr <- make.grid(nx = 7, ny = 7, spacing = 30)
tr[] <- jitter(unlist(tr), amount = spacing(tr)/2)
plot(as.mask(tr0), dots = FALSE, mesh = 'white')
plot(tr, add = TRUE)

Run the code above in your browser using DataLab