kfold: k-fold partitioning

Description Usage Arguments Value Author(s) Examples

View source: R/kfold.R

Description

k-fold partitioning of a data set for model testing purposes. Each record in a matrix (or similar data structure) is randomly assigned to a group. Group numbers are between 1 and k.

Usage

1
kfold(x, k=5, by)

Arguments

x

vector, matrix, data.frame

k

number of groups

by

Optional argument. A vector or factor with sub-groups (e.g. species). Its length should be the same as the number of records in x

Value

a vector with group assignments

Author(s)

Robert J. Hijmans

Examples

1
2
3
k <- kfold(1:100, 5)
k[1:25]
table(k)

ani-ghosh/luna_dev documentation built on Nov. 18, 2019, 12:02 a.m.