possumtraps <- traps(possumCH)
## convex and concave buffers
plot(possumtraps, border = 270)
bufferContour(possumtraps, buffer = 100, add = TRUE, col = "blue")
bufferContour(possumtraps, buffer = 100, convex = TRUE, add = TRUE)
## areas
buff.concave <- bufferContour(possumtraps, buffer = 100,
plt = FALSE)
buff.convex <- bufferContour(possumtraps, buffer = 100,
plt = FALSE, convex = TRUE)
sum (sapply(buff.concave, polyarea)) ## sum over parts
sapply(buff.convex, polyarea)
## effect of nx on area
buff.concave2 <- bufferContour(possumtraps, buffer = 100,
nx = 128, plt = FALSE)
sum (sapply(buff.concave2, polyarea))
if (FALSE) {
plot(possumtraps, border = 270)
pdotContour(possumtraps, detectfn = 0, nx = 128, detectpar =
detectpar(possum.model.0), levels = c(0.1, 0.01, 0.001),
noccasions = 5, add = TRUE)
## clipping to polygon
olddir <- setwd(system.file("extdata", package = "secr"))
possumtraps <- traps(possumCH)
possumarea <- read.table("possumarea.txt", header = TRUE)
par(xpd = TRUE, mar = c(1,6,6,6))
plot(possumtraps, border = 400, gridlines = FALSE)
pdotContour(possumtraps, detectfn = 0, nx = 256, detectpar =
detectpar(possum.model.0), levels = c(0.1, 0.01, 0.001),
noccasions = 5, add = TRUE, poly = possumarea, col = "blue")
lines(possumarea)
setwd(olddir)
par(xpd = FALSE, mar = c(5,4,4,2) + 0.1) ## reset to default
}
Run the code above in your browser using DataLab