spatial_hexgrid_sample: Spatial Hexagonal Grid Sampling

View source: R/spatial_hexgrid_sample.R

spatial_hexgrid_sampleR Documentation

Spatial Hexagonal Grid Sampling

Description

This function generates a hexagonal grid and performs spatial sampling based on the provided data and parameters.

Usage

spatial_hexgrid_sample(
  data,
  sidelength,
  top_type = "flat",
  show_grid = TRUE,
  fold_selection = "default",
  k = NULL
)

Arguments

data

The input data. It can be either an sf object or a SpatialPoints object.

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.

Value

A list containing the plots (if 'show_grid' is TRUE), the hexagonal blocks (sf object), and the split objects.

Examples

# 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)



suvedimukti/stdcab documentation built on Aug. 7, 2023, 2:28 p.m.