Learn R Programming

healthcareai (version 2.1.1)

split_train_test: Split data into training and test data frames

Description

Split data into training and test data frames

Usage

split_train_test(d, outcome, percent_train = 0.8, seed)

Arguments

d

Data frame

outcome

Target column, unquoted. Split will be stratified across this variable

percent_train

Proportion of rows in d to put into training. Default is 0.8

seed

Optional, if provided the function will return the same split each time it is called

Value

A list of two data frames with names train and test

Details

This function wraps `caret::createDataPartition`.

Examples

Run this code
# NOT RUN {
split_train_test(mtcars, am, .9)
# }

Run the code above in your browser using DataLab