Skip to contents

Prepare spatial and spatiotemporal cross validation sets

Usage

generate_cv_index_sp(
  data,
  target_cols = c("lon", "lat"),
  cv_make_fun = spatialsample::spatial_block_cv,
  ...
)

Arguments

data

data.table with X, Y, and time information.

target_cols

character(3). Names of columns for X, Y. Default is c("lon", "lat"). It is passed to sf::st_as_sf to subsequently generate spatial cross-validation indices using spatialsample::spatial_block_cv and spatialsample::spatial_clustering_cv.

cv_make_fun

function(1). Function to generate spatial cross-validation indices. Default is spatialsample::spatial_block_cv.

...

Additional arguments to be passed to cv_make_fun.

Value

A list of numeric vectors with in- and out-of-sample row indices or a numeric vector with out-of-sample indices.