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)
Run the code above in your browser using DataLab