Skip to contents

Split data into train and test sets.

Usage

split_data(data, prop = 0.7)

Arguments

data

A data frame.

prop

The proportion of rows to assign to the training set.

Value

A list with two data frames, train and test.

Examples

set.seed(123)
parts <- split_data(Fingers, prop = 0.8)
nrow(parts$train)
#> [1] 125
nrow(parts$test)
#> [1] 32