Learn R Programming

funModeling (version 1.0)

get_sample: Sampling training and test data

Description

Split input data into training and test set, retrieving always same sample by setting the seed.

Usage

get_sample(data, percentage_tr_rows = 0.8, seed = 987)

Arguments

Value

TRUE/FALSE vector same length as 'data' param. TRUE represents that row position is for training data

Examples

Run this code
## Training and test data. Percentage of training cases default value=80\%.
index_sample=get_sample(data=heart_disease, percentage_tr_rows=0.8)
## Generating the samples
data_tr=heart_disease[index_sample,]
data_ts=heart_disease[-index_sample,]

Run the code above in your browser using DataLab