resample_strat_uniform | R Documentation |
resample_strat_uniform
draws a stratified random sample (with
or without replacement) from the samples in data
. Stratification is over
the levels of data[, param$response]
. The same number of samples is drawn
within each level.
resample_strat_uniform( data, param = list(strat = "class", nstrat = Inf, replace = FALSE) )
data |
a |
param |
a list with the following components: |
If param$replace=FALSE
, a subsample of size
min(param$n,nrow(data))
will be drawn from data
. If param$replace=TRUE
,
the size of the subsample is param$n
.
a data.frame
containing a subset of the rows of data
.
resample_uniform()
, sample()
data(ecuador) # Muenchow et al. (2012), see ?ecuador d <- resample_strat_uniform(ecuador, param = list(strat = "slides", nstrat = 100) ) nrow(d) # == 200 sum(d$slides == "TRUE") # == 100
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.