View source: R/strata.sample.R
strata.sample | R Documentation |
With this function you receive a sample of each strata within your data with specified size for each strata.
strata.sample(data, n, replace = FALSE)
data |
Population data consisting of a number of columns of data and a last column specifying the strata each instance belongs to. |
n |
Numeric array of sample sizes for each strata to be taken. |
replace |
Whether the sample to be taken can have repeated instances or not. |
n length must be equal to number of strata in data.
On return list each strata sample can be accessed calling object$strataname where
strataname are values of the last column of the original data.
A list containing one strata sample per index.
data<-cbind(rnorm(500, 50, 20), rep(c("clase 1", "clase 2","clase 3","clase4"),125))
strata.sample(data=data, n=c(10,20,30,40))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.