Splits a dataset to a train and a test sets of a user defined percentage

Share:

Description

This function takes as input a dataset and splits it into a train and a test set based to a user defined percentage.

Usage

1
    sampling(Data,valPercent,classLabels,seed)

Arguments

Data

The input dataset to be split as an eSet object.

valPercent

The percentage of the input dataset used for validation purposes e.g. 40.

classLabels

The varLabels name in the eSet object where the class labels are stored e.g "type".

seed

Setting the seed number for reproducible sampling. The default value is 1.

Value

trainData

The data used for training as an eSet object

testData

The data used for validation as an eSet object

Author(s)

Argiris Sakellariou

Examples

1
2
3
library(mAPKLData)
data(mAPKLData)
breast <- sampling(Data=mAPKLData, valPercent=40, classLabels="type", seed=135)