| stratify-utilities {simFrame} | R Documentation |
Generic utility functions for stratifying data. These are useful if not all the
information of class "Strata" is necessary.
getStrataLegend(x, design) getStrataSplit(x, design, USE.NAMES = TRUE) getStrataTable(x, design) getStratumSizes(x, design, USE.NAMES = TRUE) getStratumValues(x, design, split)
x |
the data.frame to be stratified. For getStratumSizes,
it is also possible to supply a list in which each list element contains
the indices of the observations belonging to the corresponding stratum (as
returned by getStrataSplit). |
design |
a character, logical or numeric vector specifying the variables (columns) to be used for stratification. |
USE.NAMES |
a logical indicating whether information about the strata
should be used as names for the result. |
split |
an optional list in which each list element contains the indices
of the observations belonging to the corresponding stratum (as returned by
getStrataSplit). |
For getStrataLegend, a data.frame describing the strata.
For getStrataSplit, a list in which each element contains the
indices of the observations belonging to the corresponding stratum.
For getStrataTable, a data.frame describing the strata
and containing the stratum sizes.
For getStratumSizes, a numeric vector of the stratum sizes.
For getStratumValues, a numeric vector giving the stratum number for
each observation.
Andreas Alfons, alfons@statistik.tuwien.ac.at
data(eusilc)
## all data
getStrataLegend(eusilc, c("region", "gender"))
getStrataTable(eusilc, c("region", "gender"))
getStratumSizes(eusilc, c("region", "gender"))
## small sample
sam <- draw(eusilc, size = 25)
getStrataSplit(sam, "gender")
getStratumValues(sam, c("region","gender"))