partition_data: Partition data in train and test set

Description Usage Arguments Value Examples

Description

partition_data partition data randomly in train and test sets.

Usage

1
partition_data(x, y, train_ind = NULL, train_perc = 0.7)

Arguments

x

Input / Independent variables

y

Dependent variables

train_ind

Index of traininig data, if NULL a random one is generated.

train_perc

Percentage of training data when partitioning.

Value

A list containing the train, test data and index of training data.

Examples

1
2
3
4
5
6
7
8
9
x <- matrix(c(-20, 0, 15, 20, 20, 10, 4, 5), ncol=2)
y <- c(2, 5, 0, 8)
data <- partition_data(x, y)

##
x <- matrix(c(-20, 0, 15, 20, 20, 10, 4, 5), ncol=2)
y <- c(2, 5, 0, 8)
train_ind <- c(1,4)
data <- partition_data(x, y, train_ind)

andreaskapou/mpgex documentation built on May 12, 2019, 3:33 a.m.