.stratified | R Documentation |
All credit for this function goes to user mrdwab on GitHub : https://gist.github.com/mrdwab/6424112
.stratified(df, group, size, select = NULL, replace = FALSE, bothSets = FALSE)
df |
The input data.frame |
group |
A character vector of the column or columns that make up the "strata". |
size |
The desired sample size or proportion in the training set |
select |
Allows you to subset the groups in the sampling process |
replace |
For sampling with replacement. |
bothSets |
Wether or not to return both the training and validation sets |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.