# NOT RUN {
### this example demonstrates the logic of sampling in case of unbalanced distribution of classes
y <- factor(c(rep("A", 21), rep("B", 80)))
nlcv:::inTrainingSample(y, 2/3, "unbalanced")
table(y[nlcv:::inTrainingSample(y, 2/3, "unbalanced")]) # should be 14, 14 (for A, B resp.)
table(y[!nlcv:::inTrainingSample(y, 2/3, "unbalanced")]) # should be 7, 66 (for A, B resp.)
# }
Run the code above in your browser using DataLab