For bootstrap samples, simple random sampling is used. For other data splitting, the random sampling is done within the
levels of y
when y
is a factor in an attempt to balance
the class distributions within the splits.
For numeric y
, the sample is split into groups sections based
on percentiles and sampling is done within these subgroups. For
createDataPartition
, the number of percentiles is set via the
groups
argument. For createFolds
and createMultiFolds
,
the number of groups is set dynamically based on the sample size and k
.
For smaller samples sizes, these two functions may not do stratified
splitting and, at most, will split the data into quartiles.
Also, for code{createDataPartition}, very small class sizes (<= 3)="" the="" classes="" may="" not="" show="" up="" in="" both="" training="" and="" test="" data<="" p="">
For multiple k-fold cross-validation, completely independent folds are created.
The names of the list objects will denote the fold membership using the pattern
"Foldi.Repj" meaning the ith section (of k) of the jth cross-validation set
(of times
). Note that this function calls createFolds
with
list = TRUE
and returnTrain = TRUE
.
=>