datasplit: Split the data into a training set and a test set

Description Usage Arguments Value Author(s) Examples

View source: R/splitter.R

Description

This function splits the data.frame into a training set and a test set with user defined proportions.

Usage

1
datasplit(data = data, splits = splits, random = FALSE)

Arguments

data

A well-cleaned data.frame that you would like to split into a training set and a test set.

splits

A two-element vector with the first element specifying the training proportion and the second being the test proportion.

random

If TRUE, uses a random seed so you will get a different training and testing set everytime you run this. If FALSE, the draws are based on the seed (12345678). Default is random = FALSE.

Value

a list with elements:

train

the training set

test

the test set

Author(s)

Mokyo Zhou

Examples

1
2
3
4
data <- data.frame(matrix(rnorm(100*5),100,5))
traintest <- datasplit(data = data, splits = c(0.8,0.2), random = FALSE)
training <- traintest[[1]]
testing <- traintest[[2]]

MokyoZhou/lassoenet documentation built on May 20, 2019, 11:38 a.m.