powered by
Splits row indices of a data frame or matrix into k folds for cross-validation.
k
cv_split(data, v = 5, seed = NULL)
A list of length v, where each element is a vector of row indices for that fold.
v
A data frame or matrix.
Integer. Number of folds. Defaults to 5.
Optional integer. Random seed for reproducibility.
folds <- cv_split(mtcars, v = 5) str(folds)
Run the code above in your browser using DataLab