Last chance! 50% off unlimited learning
Sale ends in
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'), ...)
integer approximate number of clusters (see Details)
traps object defining a single cluster
dataframe or SpatialPolygonsDataFrame with coordinates of perimeter
scalar distance between cluster centres
vector giving x- and y-cooordinates of fixed grid origin (origin is otherwise random)
numeric; 2-vector (x,y offsets); see Details
logical; if not `all' then alternate clusters are omitted
arguments passed to trap.builder
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 |
region
may be any shape. The sp class
SpatialPolygonsDataFrame is useful for complex shapes and input from
shapefiles using rgdal (see Examples). 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.
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.
# NOT RUN {
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 {
datadir <- system.file("extdata", package = "secr")
possumarea <- rgdal::readOGR(dsn = datadir, layer = "possumarea")
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.
writeGPS(possumgrid, proj = "+proj=nzmg")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab