Create partitions {SFSI}R Documentation

Data partition into folds of the same size

Description

Create a random data partition of size n into k non-overlapping folds of approximately the same size

Usage

get_folds(n, k = 5L, nCV = 1L, seed = NULL)
        

Arguments

n

(integer) Sample size

k

(integer) Number of folds

nCV

(integer) Number of different partitions to be created

seed

(integer vector) Optional seed for randomization (see help(set.seed)). It has to be of length equal to nCV

Value

Returns a matrix with n rows and nCV columns. Each column contains a partition with k folds.

Examples

  require(SFSI)
  
  # Create 5 different partitions into 10 folds
  # for a sample size equal to 115
  out = get_folds(n=115, k=10, nCV=5)
  
  # Size of folds at first partition
  table(out[,1])
  

[Package SFSI version 1.4 Index]