powered by
Split data into train and test sets
tl_split(data, prop = 0.8, stratify = NULL, seed = NULL)
A list with train and test data frames
A data frame
Proportion for training set (default: 0.8)
Column name for stratified splitting
Random seed for reproducibility
# \donttest{ split_data <- tl_split(iris, prop = 0.7, stratify = "Species") train <- split_data$train test <- split_data$test # }
Run the code above in your browser using DataLab