tl_split: Split data into train and test sets

View source: R/preprocessing.R

tl_splitR Documentation

Split data into train and test sets

Description

Split data into train and test sets

Usage

tl_split(data, prop = 0.8, stratify = NULL, seed = NULL)

Arguments

data

A data frame

prop

Proportion for training set (default: 0.8)

stratify

Column name for stratified splitting

seed

Random seed for reproducibility

Value

A list with train and test data frames

Examples


split_data <- tl_split(iris, prop = 0.7, stratify = "Species")
train <- split_data$train
test <- split_data$test


tidylearn documentation built on Feb. 6, 2026, 5:07 p.m.