addCore: Add a raster representing a core area to a 'JAGSmask' object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/addCore.R

Description

Often we are interested in a core area which is smaller than the full extent of the habitat. This function enables you to define a core area and add the corresponding raster to the JAGSmask object.

Usage

1
2
addCore(JAGSmask, type = c("perimeter", "traps", "polygon"),
    buffer = 0, poly=NULL, cell.overlap = c("centre", "any", "all"), plot=TRUE)

Arguments

JAGSmask

The object of class JAGSmask as produced by convertMask.

type

The basis for the core area: polygon - uses the polygon given in poly; traps - includes all habitat pixels within distance buffer of a trap; perimeter - draws a minimum convex polygon around the traps and uses that as the polygon.

buffer

If buffer > 0, the a buffer of this width is added to the polygon.

poly

Bounding polygon for the core area; only used if type is poly; can be (1) a matrix or data frame of two columns interpreted as x and y coordinates, or (2) a SpatialPolygons or SpatialPolygonsDataFrame object as defined in the package sp.

cell.overlap

The criterion for including a pixel in the raster: centre - include if the centre of the pixel falls in the core; any - include if any corner of the pixel falls in the core; all - include if all four corners of the pixel fall in the core.

plot

If TRUE, the resulting mask and trap locations will be plotted (not yet implemented).

Value

The original JAGSmask object supplied as input, with an additional component coreMat, a 1/0 matrix where coreMat[x, y] = 1 if location (x, y) is in the core.

Note that the core only includes good habitat: pixels for which habMat[x,y] == 0 will also be 0 in coreMat.

Author(s)

Mike Meredith

See Also

convertMask

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(simSCR)
JAGSmask <- simSCR$JAGSmask
plot(JAGSmask)

# Part of the study area is in Arkadia municipality and we want the population
#   inside Arkadia, so we use Arkadia as the "core":
Arkadiamask <- addCore(JAGSmask, type="poly", poly=simSCR$Arkadia)
plot(Arkadiamask) # core area yellow, remainder of habitat white

# How many animals in the core area?
# Get a posterior distribution for number of ACs in the state:
Ncore <- getACinCore(simSCR$sims.list$S, simSCR$sims.list$w, Arkadiamask)
plot(table(Ncore))
mean(Ncore)       # posterior mean
quantile(Ncore, probs=c(0.025, 0.975))  # 95% credible interval

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