createCv: Creates a cross validation column

Description Usage Arguments Value Examples

View source: R/fct_CV.R

Description

createCv permit to create a cross validation column by specifiying one or more columns of the dataset, or a number of folds.

Usage

1
createCv(data, columName = NULL, kfolds = NULL, seed = NULL)

Arguments

data

data.frame, A dataset.

columName

vector, A character vector of the name of one or more columns of the dataset.

kfolds

numeric, Number of folds.

seed

numeric, A seed to specify. By default there is no seed.

Value

A vector with cross-validation fold index assignment per observation

Examples

1
2
3
4
5
6
data(mtcars)

createCv(mtcars, columName = "cyl")
createCv(mtcars, columName = c("cyl", "carb"))
createCv(mtcars, kfolds = 4)
createCv(mtcars, kfolds = 4, seed = 1234)

anaislaot/optiMod documentation built on May 19, 2019, 10:48 p.m.