combine_designs: Select points that most closely approximate the distribution...

View source: R/balance_around.R

combine_designsR Documentation

Select points that most closely approximate the distribution of another set of points and substitute them

Description

When creating a design that incorporates points from another design to revisit, it can be important to approximate the same spatial distribution, especially if the design is spatially balanced. This will substitute in revisit points that will cause the least shift in the spatial distribution.

Usage

combine_designs(
  sub_points,
  template_points,
  sub_idvar = "plotid",
  template_idvar = "plotid",
  sub_counts = NULL,
  strata_polygons = NULL,
  polygons_stratavar = "stratum",
  sub_stratavar = "stratum",
  template_stratavar = "stratum",
  projection = NULL,
  iteration_limit = 5000
)

Arguments

sub_points

Point sf object. The points you would like to substitute from by comparing against template_points.

template_points

Point sf object. The points you would like to compare against sub_points in order to select a subset of those that most closely resemble the distribution of the template points.

sub_idvar

Character string. The name of the variable in sub_points that contains the unique identifiers. Defaults to "plotid".

template_idvar

Character string. The name of the variable in template_points that contains the unique identifiers. Defaults to "plotid".

sub_counts

Optional named numeric vector. A vector of the number of template points to replace with the closest approximation from the existing points in each stratum. Only use if there is more than one stratum. The names of the vector must exactly match the strata of the points. If NULL then points will be allocated proportionally by area using the value in replacement_count. Defaults to NULL.

strata_polygons

Optional polygon sf object. Polygons assigned a variable with a name polygons_stratavar that contains the membership information (e.g. strata) to assign to sub_points and template_points. If NULL then no assignment will be attempted. Defaults to NULL.

polygons_stratavar

Optional character string. If strata_polygons is not NULL, the name of the variable in strata_polygons that contains the membership information. Otherwise, the name of the variable in both template_points and sub_points that contains the membership information. If NULL then the points will be considered to belong to a single group. Defaults to "stratum".

sub_stratavar

Optional character string. The name of the variable in sub_points that contains the membership information. If both sub_stratavar and template_stratavar are NULL then all the points in both will be considered to belong to a single group. Defaults to "stratum".

template_stratavar

Optional character string. The name of the variable in template_points that contains the membership information. If both sub_stratavar and template_stratavar are NULL then all the points in both will be considered to belong to a single group. Defaults to "stratum".

projection

Optional character string or CRS object. The projection to force all spatial objects into, e.g. "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0". If NULL then the projection from template_points@proj4string will be used. Defaults to NULL.

iteration_limit

Numeric. The upper limit on the number of iterations to try to match points in sub_points to their best-fitting mates in template_points. Defaults to 5000.

Value

A spatial points data frame of the template_points with points from sub_points substituted in. It will be in the projection specified by projection.


nstauffer/sample.design documentation built on May 9, 2022, 3:21 a.m.