Learn R Programming

tidylearn (version 0.1.0)

tl_split: 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)

Value

A list with train and test data frames

Arguments

data

A data frame

prop

Proportion for training set (default: 0.8)

stratify

Column name for stratified splitting

seed

Random seed for reproducibility

Examples

Run this code
# \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