csplit {lava} | R Documentation

## Split data into folds

### Description

Split data into folds

### Usage

    csplit(x, p = NULL, replace = FALSE, return.index = FALSE, k = 2, ...)

### Arguments

`x` | Data or integer (size)
`p` | Number of folds, or if a number between 0 and 1 is given two folds of size p and (1-p) will be returned
`replace` | With or with-out replacement
`return.index` | If TRUE index of folds are returned otherwise the actual data splits are returned (default)
`k` | (Optional, only used when p=NULL) number of folds without shuffling
`...` | additional arguments to lower level functions

### Author(s)

Klaus K. Holst

### Examples

    foldr(5,2,rep=2)
    csplit(10,3)
    csplit(iris[1:10,]) ## Split in two sets 1:(n/2) and (n/2+1):n
    csplit(iris[1:10,],0.5)

[Package lava version 1.5.1 Index]