temptrap <- make.grid(nx = 10, ny = 10, spacing = 30)
## default method: traprect
tempmask <- make.mask(temptrap, spacing = 5)
plot(tempmask)
summary (tempmask)
## make irregular detector array by subsampling
## form mask by `trapbuffer' method
temptrap <- subset (temptrap, sample(nrow(temptrap), size = 30))
tempmask <- make.mask (temptrap, spacing = 5, type = "trapbuffer")
plot (tempmask)
plot (temptrap, add = TRUE)
## form mask by "pdot" method
temptrap <- make.grid(nx = 6, ny = 6)
tempmask <- make.mask (temptrap, buffer = 150, type = "pdot",
pdotmin = 0.0001, detectpar = list(g0 = 0.1, sigma = 30),
noccasions = 4)
plot (tempmask)
plot (temptrap, add = TRUE)
## Using an ESRI polygon shapefile for clipping (shapefile
## polygons may include multiple islands and holes).
## Requires the `maptools' package of Nicholas J. Lewin-Koh, Roger
## Bivand, and others; `maptools' uses the `sp' package of spatial
## classes by Ed Pebesma and Roger Bivand.
## Not run: ------------------------------------
#
# datadir <- system.file("extdata", package = "secr")
# possumareafile <- paste0(datadir, "/possumarea.shp")
# possumarea <- rgdal::readOGR(dsn = possumareafile, layer = "possumarea")
#
# possummask2 <- make.mask(traps(possumCH), spacing = 20,
# buffer = 250, type = "trapbuffer", poly = possumarea)
# par(mar = c(1,6,6,6), xpd = TRUE)
# plot (possummask2, ppoly = TRUE)
# plot(traps(possumCH), add = T)
# par(mar = c(5,4,4,2) + 0.1, xpd = FALSE)
#
# ## if the polygon delineates non-habitat ...
# seaPossumMask <- make.mask(traps(possumCH), buffer = 1000,
# type = "traprect", poly = possumarea, poly.habitat = FALSE)
# plot(seaPossumMask)
# plot(traps(possumCH), add = T)
# ## this mask is not useful!
#
## ---------------------------------------------
<!-- %% ## OR, as this is a simple polygon, just... -->
<!-- %% possumarea <- possumarea@polygons[[1]]@Polygons[[1]]@coords -->
<!-- %% possummask2 <- make.mask(traps(possumCH), spacing = 20, poly = possumarea, -->
<!-- %% buffer = 250, type = "trapbuffer") -->
Run the code above in your browser using DataLab