par_pad_balanced {chopin} | R Documentation |
Extension of par_make_balanced for padded grids
Description
This function utilizes anticlust::balanced_clustering()
to split the input into equal size subgroups then transform the data
to be compatible with the output of par_pad_grid
, for which
a set of padded grids of the extent of input point subsets
(as recorded in the field named "CGRIDID"
)
is generated out of input points.
Usage
par_pad_balanced(points_in = NULL, ngroups, padding)
Arguments
points_in |
|
ngroups |
integer(1). The number of groups. |
padding |
numeric(1). A extrusion factor to make buffer to clip actual datasets. Depending on the length unit of the CRS of input. |
Value
A list of two,
-
original
: exhaustive and non-overlapping grid polygons in the class of input -
padded
: a square buffer of each polygon inoriginal
. Used for computation.
Author(s)
Insang Song
See Also
Other Parallelization:
par_cut_coords()
,
par_grid()
,
par_grid_mirai()
,
par_hierarchy()
,
par_hierarchy_mirai()
,
par_make_grid()
,
par_merge_grid()
,
par_multirasters()
,
par_multirasters_mirai()
,
par_pad_grid()
,
par_split_list()
Examples
lastpar <- par(mfrow = c(1, 1))
library(terra)
library(sf)
options(sf_use_s2 = FALSE)
ncpath <- system.file("gpkg/nc.gpkg", package = "sf")
nc <- terra::vect(ncpath)
nc_rp <- terra::spatSample(nc, 1000)
nc_gr <- par_pad_balanced(nc_rp, 10L, 1000)
nc_gr
par(lastpar)