Learn R Programming

bestglm (version 0.37.3)

trainTestPartition: Partition Dataframe into Train/Test Samples

Description

Dataframe used to create training and test datasets using specified fraction for the training sample. The data matrix must be comprised of continuous variables only (no factors).

Usage

trainTestPartition(Xy, trainFrac = 2/3)

Arguments

Xy

Dataframe with column names, last column is the response variable and others are the regression input variables. The data matrix must be comprised of continuous variables only (no factors).

trainFrac

Fraction to be used for the training sample.

Value

A list with components

XyTr

Training dataframe.

XTr

Matrix, input training variables.

yTr

Vector, output training variable.

XyTe

Training dataframe.

XTe

Matrix, input test variables.

yTe

Vector, output test variable.

XyTr

Training dataframe.

XyTr

Training dataframe.

XyTr

Training dataframe.

Examples

Run this code
# NOT RUN {
set.seed(7733551)
out <- trainTestPartition(mcdonald)
round(glmnetGridTable(out),4)
# }

Run the code above in your browser using DataLab