rcoords: Sample points in a random-centered area or tethered group of...

View source: R/create.outer.R

rcoordsR Documentation

Sample points in a random-centered area or tethered group of areas. This function provides a way to randomly generate one or more groups of points, such that groups are non-overlapping, and options for controlling proximity, group sizes, and optional requirement that points occur over land. At present areas are circles projected onto a euclidean plane.

Description

Sample points in a random-centered area or tethered group of areas.

This function provides a way to randomly generate one or more groups of points, such that groups are non-overlapping, and options for controlling proximity, group sizes, and optional requirement that points occur over land. At present areas are circles projected onto a euclidean plane.

Usage

rcoords(
  regionsize = 0.25,
  samplesize = 100,
  n.grp = 1,
  grp.n.weights = NULL,
  grp.area.weights = NULL,
  min.grp.size = 2,
  wnd = c(-180, 180, -90, 90),
  over.land = TRUE,
  interactions = c(0, 1),
  show.plot = FALSE,
  return.as = "data.frame"
)

Arguments

regionsize

Number between 0 and 1 specifying the fraction of the possible sampling area (the window region set by 'wnd' argument) in which points may be distributed. Default 0.25. When 'wnd' is default (entire Earth), regionsize is default (0.25), and ('over.land' condition is FALSE), then minimum convex hull of all sampled points is expected to cover 1/4 of Earth.

samplesize

Total number of points to sample. Default 100.

n.grp

Number of groups to sample (default 1). Each group is defined by its own spatial polygon from which samples are drawn. The center of each group's sampling polygon falls within a polygon with size = ('regionsize' * area of 'wnd').

grp.n.weights

Probability weights for group sample sizes of groups. Default is equal weights. The sum of points sampled for each group = 'samplesize' argument.

grp.area.weights

Probability weights determing group region sizes. Default is equal weights.

min.grp.size

Minimum number of samples required for each group. Default 2.

wnd

Either a character string or vector describing one or more regions of Earth, or a length four numerical vector specifying the bounding box (longitude and latitude ranges) for the region where sampling is allowed. Default is to include all of Earth c(-180,180,-90,90). FUTURE OPTION: 'wnd' is a matrix with four columns, with each row describing the bounding box for one of the populations. Character strings can be one of the following (NOT ENTIRELY IMPLEMENTED): "Earth", "tropics", "middleSouth", "middleNorth" "middle", "Arctic", "Antarctic", "Polar", "NorthernHemisphere", "WesternHemisphere", or "EasternHemisphere".

over.land

Logical indicating whether or not all returned points must occur over land. Default TRUE. Note that this condition is only applied to samples returned as output. Therefore, 'samplesize' is really a 'sample until' rule. This is faster than performing clipping operations on proposed sample polygons to conform to geography.

interactions

Numeric vector with the minimum and maximum amount of overlap between each pair of groups (aka populations), calculated as (intersect area)/(minimum of non-intersected area for each group). Default c(0,1) allows for all possible scenarios. Examples: c(0,0) specifies that groups must be allopatric; c(1,1) requires complete overlap of groups, which is not realistic given the stochasticity determining region sizes; c(0.5,1) requires that at least half-overlaps between groups; c(0.2,0.25) specifies a small contact zone.

show.plot

Whether or not the points should be plotted on a low-resolution land map. The map is used is the rnaturalearth countries map, 110 meter resolution.

return.as

Character string with class to use for object returned. Default "data.frame". Can also be "matrix" or "SP" (SpatialPoints).

r

Number specifying the radius of group areas, in decimal degrees, or a numerical vector with min and max values of uniform sampling distribution from which radii of areas will be drawn.

d.grp

Number controlling the distance between the centers of a pair of areas, as a function of the pair's radii. Default 1, which would allow sample regions to nearly coincide. Future option may allow for a pairwise distance matrix.

expf

Number that affects dispersion relative to regionsize. Higher numbers increase dispersion. Default 8.

grp.scaler

Number > 0 that scales geographical areas of all groups

Value

An object with class equal to the value of 'return.as' and containing the set of points that meet the specified sampling requirements. If return.as='matrix' or 'data.frame', the columns are 'X' (for longitude), 'Y' (for latitude), and 'group' (all 1 if 'n.grp'=1).


JeffWeinell/misc.wrappers documentation built on Sept. 20, 2023, 12:42 p.m.