Description Usage Arguments Details Examples
Map an object x
into equal (or nearly equal) size folds.
If x
is a positive integer, a vector of FoldIDs of length matching x is returned, otherwise
If x
is a vector, a matching vector of FoldIDs is returned.
If x
is a data.table, a list of partitions of x is returned.
1 |
x |
A positive integer, a vector of values or a data.table object |
nfolds |
How many folds? |
stratified |
If x is a vector then TRUE or FALSE indicating whether x's split the class's of x proportionally. If x
is a data.table then |
seed |
Random number seed |
Convenient method for mapping an object into equal size folds, potentially with stratification
1 2 3 4 5 6 | library(data.table)
folds(8, nfolds=2)
folds(alien.train$IsAlien, nfolds=2)
folds(alien.train$IsAlien, nfolds=2, stratified=TRUE, seed=2016)
folds(alien.train$IQScore, nfolds=2, stratified=TRUE, seed=2016)
folds(alien.train, nfolds=2, stratified="IsAlien", seed=2016)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.