subgroup: Random Grouping II

Description Usage Arguments Details Value Source Examples

View source: R/subgroup.R

Description

Random grouping function for index of train set’s row to divide into 2 groups.

Usage

1
subgroup(training, yname, levels)

Arguments

training

a train set that needs to be grouped by row.

yname

the name of result-column.

levels

results in result-column.

Details

Randomly split train set into two mutually exclusive parts. Classify the first part based on levels of yname.

Value

The value returned is a list of 3 sets. The first set X1_0 and second set X1_1 are samples of two different levels in the first part of train set respectively. The third set X2 is the second part of train set.

Source

For sample, based on

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Ripley, B. D. (1987) Stochastic Simulation. Wiley.

Examples

1
2
3
4
intest = subnum(rawdata, k=10)[[1]]
test = rawdata[intest,]
training = rawdata[-intest,]
groups = subgroup(training, 'class', c('attack', 'normal'))

ShanLu92/FeaAug documentation built on Jan. 31, 2021, 7:21 p.m.