View source: R/spatial_hexgrid_sample.R
spatial_hexgrid_sample | R Documentation |
This function generates a hexagonal grid and performs spatial sampling based on the provided data and parameters.
spatial_hexgrid_sample(
data,
sidelength,
top_type = "flat",
show_grid = TRUE,
fold_selection = "default",
k = NULL
)
data |
The input data. It can be either an |
sidelength |
The length of the hexagon's side. |
top_type |
The type of the hexagon top, either "flat" or "pointy". Default is "flat". |
show_grid |
Logical value indicating whether to display the hexagonal grid. Default is TRUE. |
fold_selection |
The method for fold selection. Options include "default", "systematic", or "random". Default is "default". |
k |
The number of folds for fold selection. Required when 'fold_selection' is "systematic" or "random". Default is NULL. |
A list containing the plots (if 'show_grid' is TRUE), the hexagonal blocks (sf object), and the split objects.
# Load sample data
data(landcover)
# Generate a spatial hexagonal grid sampling with a sidelength of
# 10 km and 5 folds using systematic selection
hexgrid <- spatial_hexgrid_sample(landcover, sidelength = 10000,
fold_selection = "systematic", k = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.