# Create k-fold partitions of a dataset (e.g., iris)
folds <- k_fold(sample_random(), iris, k = 5)
# Use the first fold as the test set and combine the remaining folds for the training set
train_test_split <- train_test_from_folds(folds, k = 1)
# Display the training set
head(train_test_split$train)
# Display the test set
head(train_test_split$test)
Run the code above in your browser using DataLab