## Segments for 10-fold randomised cross-validation:
cvsegments(100, 10)
## Segments with four objects, taken consecutive:
cvsegments(60, length.seg = 4, type = "cons")
## Incomplete segments
segs <- cvsegments(50, length.seg = 3)
attr(segs, "incomplete")
## Leave-one-out cross-validation:
cvsegments(100, 100)
## Leave-one-out with variable/unknown data set size n:
n <- 50
cvsegments(n, length.seg = 1)
## Data set with replicates
cvsegments(100, 25, nrep = 2)
## Note that rows 1 and 2 are in the same segment, rows 3 and 4 in the
## same segment, and so on.
## Stratification
cvsegments(10, 3, type = "consecutive", stratify = c(rep(1,7), rep(2,3)))
## Note that the last three samples are spread across the segments
## according to the stratification vector.
cvsegments(20, 3, type = "consecutive", nrep = 2, stratify = c(rep(1,7), rep(2,3)))
## Note the length of stratify matching number of replicate sets, not samples.
Run the code above in your browser using DataLab