View source: R/balance_around.R
get_closest | R Documentation |
Sometimes you have a large collection of points which are not randomly distributed or spatially balanced and you would like a subset that more or less do. Given a template of points that are distributed the way you would like, this will return the closest existing point to each. This can be done taking into account membership in a group, either by having assigned it as a variable in both sets of points or by providing polygons that can be used to assign membership. By default, no stratification/membership is taken into account.
get_closest( existing_points, template_points, strata_polygons = NULL, stratafield = NULL, projection = "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0", iteration_limit = 5000 )
existing_points |
Point sf object. The points you would like to select from by comparing against |
template_points |
Point sf object. The points you would like to compare against |
strata_polygons |
Optional polygon sf object. Polygons assigned a variable with a name |
stratafield |
Character string. If |
projection |
Character string. The projection to force all spatial objects into. Defaults to NAD83, |
iteration_limit |
Numeric. The maximum number of iterations to attempt to sort before giving up. Defaults to |
A spatial points data frame made by trimming existing_points
down to the points that most closely approximate the distribution of template_points
while also containing the same number of points as template_points
. It will be in the projection specified by projection
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.