make.systematic {secr} | R Documentation |
A rectangular grid of clusters within a polygonal region.
make.systematic(n, cluster, region, spacing = NULL, origin = NULL,
originoffset = c(0,0), chequerboard = c('all','black','white'),
order = c('x', 'y', 'xb', 'yb'), rotate = 0, centrexy = NULL,
keep.design = TRUE, ...)
n |
integer approximate number of clusters (see Details) |
cluster |
traps object defining a single cluster |
region |
dataframe or SpatialPolygonsDataFrame with coordinates of perimeter |
spacing |
scalar distance between cluster centres |
origin |
vector giving x- and y-cooordinates of fixed grid origin (origin is otherwise random) |
originoffset |
numeric; 2-vector (x,y offsets); see Details |
chequerboard |
logical; if not ‘all’ then alternate clusters are omitted |
order |
character; sort order for clusters (see Details) |
rotate |
numeric; number of degrees by which to rotate entire design clockwise about centroid of region bounding box |
centrexy |
numeric; 2-vector for centre of rotation, if any |
keep.design |
logical; if TRUE then input argument values are retained |
... |
arguments passed to |
region
may be any shape.
region
may be one of the spatial classes described
in boundarytoSF
. Otherwise,
region
should be a dataframe with columns ‘x’ and ‘y’.
spacing
may be a vector with separate values for spacing in x-
and y- directions. If spacing
is provided then n
is ignored.
If n
is a scalar, the spacing of clusters is determined from
the area of the bounding box of region
divided by the requested
number of clusters (this does not necessarily result in exactly n
clusters). If n
is a vector of two integers these are taken to be
the number of columns and the number of rows.
After preparing a frame of cluster centres, make.systematic
calls trap.builder
with method = ‘all’; ... allows the
arguments ‘rotation’, ‘edgemethod’, ‘plt’, and ‘detector’ to be
passed. Setting the trap.builder
arguments frame
,
method
, and samplefactor
has no effect.
Note the distinction between argument rotate
and the trap.builder
argument rotation
that is applied separately to each cluster.
If origin
is not specified then a random uniform origin is chosen within a box (width = spacing) placed with its bottom left corner at the bottom left of the bounding box of region
, shifted by originoffset
. Before version 3.1.8 the behaviour of make.systematic
was equivalent to originoffset = c(wx,wy)
where wx,wy
are the cluster half widths.
chequerboard = "black"
retains black ‘squares’ and chequerboard = "white"
retains white ‘squares’, where the lower left cluster in the candidate rectangle of cluster origins is black, as on a chess board. The effect is the same as increasing spacing by sqrt(2) and rotating through 45 degrees.
order
determines the ordering of clusters in the resulting traps object. The options are a subset of those for ID
argument of make.grid
:
Option | Sort order |
x | column-dominant |
y | row-dominant |
xb | column-dominant boustrophedonical (alternate columns reversed) |
yb | row-dominant boustrophedonical (alternate rows reversed) |
rotate
rotates the array about the given centre (default is centroid of the bounding box of region
).
A single-session ‘traps’ object.
From 3.2.0 these additional attributes are set –
origin | coordinates of grid origin |
centres | coordinates of true cluster centres (cf cluster.centres ) |
originbox | vertices of rectangular spatial sampling frame for random origin |
From 4.2.0 if keep.design
is TRUE then the input argument values are retained in attribute ‘design’ (a list with first component function = 'make.systematic'
).
Do not confuse with the simpler function make.grid
,
which places single detectors in a rectangular array.
trap.builder
,
make.lacework
,
cluster.centres
mini <- make.grid(nx = 2, ny = 2, spacing = 100)
region <- cbind(x=c(0,2000,2000,0), y=c(0,0,2000,2000))
temp <- make.systematic(25, mini, region, plt = TRUE)
temp <- make.systematic(c(6, 6), mini, region, plt = TRUE,
rotation = -1)
## Example using shapefile "possumarea.shp" in
## "extdata" folder. By default, each cluster is
## a single multi-catch detector
## Not run:
library(sf)
shpfilename <- system.file("extdata/possumarea.shp", package = "secr")
possumarea <- st_read(shpfilename)
possumgrid <- make.systematic(spacing = 100, region =
possumarea, plt = TRUE)
## or with 2 x 2 clusters
possumgrid2 <- make.systematic(spacing = 300,
cluster = make.grid(nx = 2, ny = 2, spacing = 100),
region = possumarea, plt = TRUE, edgemethod =
"allinside")
## label clusters
text(cluster.centres(possumgrid2), levels(clusterID
(possumgrid2)), cex=0.7)
## If you have GPSBabel installed and on the Path
## then coordinates can be projected and uploaded
## to a GPS with `writeGPS', which also requires the
## package `proj4'. Defaults are for a Garmin GPS
## connected by USB.
if (interactive()) {
writeGPS(possumgrid, proj = "+proj=nzmg")
}
## End(Not run)