spatial_sample_plus_close_pairs: Take a spatially dispersed sample from a set of 2D points,...

Description Usage Arguments Value Examples

View source: R/spatial_plus_close_pairs.R

Description

Take a spatially dispersed sample from a set of 2D points, with optional inclusion of close-pairs of points. Designed for estimation of spatial covariance an spatial prediction. The algorithm works by first selecting a single site randomly and then iteratively selecting further sites with probability proportional to the distance to nearest selected site (i.e. there is a greater probability of being selected the further a site is from the nearest selected site). If 'n_close' is specified, then clusters of close pairs of points are included in the selection.

Usage

1
2
spatial_sample_plus_close_pairs(coords, n_close = 0, n_spatial,
  power = 1)

Arguments

coords

An sf object of points to sample from.

n_close

Optional. The number of closely separated points to select. Must be multiple of 5.

n_spatial

Optional. The number of spatially dispersed points to select.

power

Controls the relative influence of distance between selected and unselected sites when selecting sites

Value

Returns a list with 'sample' - the coordinates of selected points and 'sample_idx' - the row indeces of the selected coordinates.

Examples

1
2
3
4
coords <- data.frame(x = runif(1000,0,1), y = runif(1000,0,1))
points <- st_as_sf(SpatialPoints(coords))
samp <- spatial_sample_plus_close_pairs(points, n_close = 50, n_spatial = 50)
plot(coords, col="gray"); points(coords[samp$sample_idx,], pch=16)

disarm-platform/DiSARM documentation built on March 4, 2020, 3:49 p.m.