train.test.split: Train test split

Description Usage Arguments Value Examples

Description

Split a dataframe into two dataframes, one for testing and one for training. Very similar to sklearn.model_selection.train_test_split

Usage

1
train.test.split(data, test.size = 0, train.size = 0, shuffle = TRUE)

Arguments

data

A dataframe to split into test and train

test.size

Either an integer indicating the number of rows that should be in test, or a percentage (expressed as a number between 0 and 1) of the number of rows from data that should be in test

train.size

Either an integer indicating the number of rows that should be in train, or a percentage (expressed as a number between 0 and 1) of the number of rows from data that should be in train

shuffle

A boolean indicating if the dataframe should be shuffled, defaults to TRUE

Value

A named list where 'test' is the test dataframe and 'train' is the train dataframe

Examples

1
2
3
data("mtcars")
train.test.split(mtcars, train.size = 0.7)
train.test.split(mtcars, test.size = 14)

TimothyWillard/timsrutils documentation built on May 29, 2019, 7:11 a.m.