R: Partition Dataframe into Train/Test Samples

trainTestPartition {bestglm} | R Documentation

## Partition Dataframe into Train/Test Samples

### Description

Dataframe used to create training and test datasets using specified fraction for the training sample.

### 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.
`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.

### Author(s)

A. I. McLeod

### Examples

    set.seed(7733551)
    out <- trainTestPartition(mcdonald)
    round(glmnetGridTable(out),4)

[Package bestglm version 0.36 Index]