Learn R Programming

secr (version 3.0.1)

make.systematic:

Description

A rectangular grid of clusters within a polygonal region.

Usage

make.systematic(n, cluster, region, spacing = NULL, origin = NULL, ...)

Arguments

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)
arguments passed to trap.builder

Value

A single-session `traps' object.

Details

region may be any shape. The sp class SpatialPolygonsDataFrame is useful for complex shapes and input from shapefiles using maptools (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.

See Also

trap.builder, cluster.centres, readOGR

Examples

Run this code

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")
# possumareafile <- paste0(datadir, "/possumarea.shp")
# possumarea <- rgdal::readOGR(dsn = possumareafile, 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")
# 
## ---------------------------------------------

Run the code above in your browser using DataLab