res <- resample(iris, setup_KFold(seed = 2026))
iris_train <- iris[res[[1]], ]
iris_test <- iris[-res[[1]], ]
# Preprocess training data
iris_pre <- preprocess(iris_train, setup_Preprocessor(scale = TRUE, center = TRUE))
# Apply the same preprocessing to test data
iris_test_pre <- apply_preprocessor(iris_pre, iris_test)
Run the code above in your browser using DataLab