Randomly assigns the population to k folds and returns a random sample made of elements from k-1 folds. See the Details section below for further information.
Details
Each element in the population is randomly assigned to one of the k
folds by using the randomKFolds
function.
If provided, i
indicates the i-th fold to be considered as holdout data.
If i
is missing, one fold is randomly selected to be the holdout data.
A random sample is then generated by removing the i-th fold and merging the
remaining k - 1 folds together.
Examples
#Set seed for reproducibility
set.seed(seed = 5381L)
#Assign data to 3 folds
randomKm1Folds(N = 10, k = 3)
#> [1] 2 4 6 7 9 10