Split observations or groups of observations into
training and test data to be used for (repeated) random
splitting (also known as random subsampling or Monte
Carlo cross-validation).
Usage
randomSplits(n, m, R = 1, grouping = NULL)
Arguments
n
an integer giving the number of observations to
be split into training and test data. This is ignored if
grouping is supplied in order to split groups of
observations into folds.
m
an integer giving the number of observations or
groups of observations to be used as test data.
R
an integer giving the number of random data
splits.
grouping
a factor specifying groups of
observations. If supplied, the data are split according
to the groups rather than individual observations such
that all observations within a group belong either to the
training or test data.
Value
An object of class "randomSplits" with the
following components:
nan integer giving the number of observations or
groups.
man integer giving the number of observations or
groups in the test data.
Ran integer giving the number of random data
splits.
subsetsan integer matrix in which each column
contains the indices of the observations or groups in the
test data of the corresponding random data split.
groupinga list giving the indices of the
observations belonging to each group. This is only
returned if a grouping factor has been supplied.