check_data_for_folds: Check that data has enough rows for cross-validation folds

View source: R/31_pre_processing_functions.R

check_data_for_foldsR Documentation

Check that data has enough rows for cross-validation folds

Description

Validates that the input data has at least as many rows as the number of desired folds.

Usage

check_data_for_folds(data, n_folds)

Arguments

data

A data frame or matrix.

n_folds

Integer. The number of folds to check for.

Value

NULL (called for its side effect). Throws an error if the number of rows is too small.

Examples

check_data_for_folds(matrix(1:20, nrow = 5), n_folds = 5)
## Not run: 
check_data_for_folds(matrix(1:4, nrow = 2), n_folds = 5)  # This will throw an error

## End(Not run)


HMC documentation built on June 8, 2025, 10:32 a.m.