samp_strat | R Documentation |
Select random sample with stratification from a binary group.
samp_strat(grp, len, strat = TRUE)
grp |
a character string indicating two group information. |
len |
length of random selection. |
strat |
a logical value indicated the sampling should be stratified. |
multiple group is not supported at the current stage.
a selected index.
cls <- iris[, 5, drop = TRUE]
cls <- cls[cls == "setosa" | cls == "versicolor"]
cls <- droplevels(cls)
ind <- samp_strat(cls, 6, strat = TRUE)
cls[ind]
ind <- samp_strat(cls, 5, strat = TRUE)
cls[ind]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.