convertMask: Habitat mask conversion

Description Usage Arguments Value Author(s) See Also Examples

View source: R/convertMask.R

Description

Convert a habitat mask produced by secr to the form needed for JAGS analysis.

Usage

1
convertMask(secrmask, secrtraps, plot = TRUE)

Arguments

secrmask

An object of class secr::mask as produced by the function secr::make.mask.

secrtraps

An object of class secr::traps as produced by the function secr::make.traps.

plot

If TRUE, the resulting mask and trap locations will be plotted.

Value

An object of class JAGSmask, a list with the following elements:

habMat

A 1/0 matrix, habMat[x, y] = 1 if location (x, y) is in good habitat.

trapMat

A 2-column matrix with the x and y coordinates of the traps in the same units as habMat

upperLimit

A length 2 vector giving the upper limit of x and y for habMat in pixel units (the lower limit for each is always 1).

pixelWidth

The width and height of the cells in habMat in the original units (usually metres).

area

The area of suitable habitat in the original units, typically square metres.

It will also have the following attributes, which can be used to convert JAGS output back to the original coordinate system:

boundingbox

A 4x2 matrix with coordinates of the 4 corners of habMat in the original units (usually metres).

origin

A vector of length 2 giving the location in the original coordinates of point 0, 0 in pixel units.

pixelWidth

The width and height of the cells in habMat in the original units (usually metres).

The pixelWidth attribute will be removed in future versions.

Author(s)

Mike Meredith

See Also

make.mask

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
require(sp)
data(simSCR)
plot(simSCR$patchSP)
points(simSCR$traps, pch=3, col='red')

# Create the 'secr' mask:
require("secr")
secrmask <- make.mask(simSCR$traps, spacing=1000,
  type='polygon', poly=simSCR$patchSP)
plot(secrmask)

# Convert to 'JAGSmask' format:
mymask <- convertMask(secrmask, simSCR$traps, plot=TRUE)

mikemeredith/makeJAGSmask documentation built on May 19, 2021, 1:10 a.m.