subnum: Random Grouping I

Description Usage Arguments Details Value Source Examples

View source: R/subnum.R

Description

Random grouping function for indexes of dataset’s row to divide into k groups.

Usage

1
subnum(data, k = 10)

Arguments

data

dataset that needs to be grouped by row.

k

the number of groups.

Details

Randomly split the number of dataset’s rows into k mutually exclusive groups. Divide the number of dataset’s rows by k and round the outcome. The result is regarded as the number of samples of each group. Use the sample( ) to extract k-1 groups out in the index of dataset’s rows, until the last group remains.

Value

The value returned is a list of k-group-index, each element of the list is the sample in indexes of rows of the grouping results.

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
intest = subnum(rawdata, k=10)

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