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 |
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 |
split |
an optional list in which each list element contains the indices
of the observations belonging to the corresponding stratum (as returned by
|
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.
get a data.frame
describing the strata, according to the variables specified by
design
.
get a list in which each
element contains the indices of the observations belonging to the
corresponding stratum, according to the variables specified by
design
.
get a data.frame
describing the strata and containing the stratum sizes, according to the
variables specified by design
.
get the stratum sizes for a list in
which each list element contains the indices of the observations belonging
to the corresponding stratum (as returned by getStrataSplit
).
get the stratum sizes of a
data set, according to the variables specified by design
.
get the
stratum number for each observation, according to the variables specified
by design
. A previously computed list in which each list element
contains the indices of the observations belonging to the corresponding
stratum (as returned by getStrataSplit
) speeds things up a bit.
get the
stratum number for each observation, according to the variables specified
by design
.
Andreas Alfons
data(eusilcP) ## all data getStrataLegend(eusilcP, c("region", "gender")) getStrataTable(eusilcP, c("region", "gender")) getStratumSizes(eusilcP, c("region", "gender")) ## small sample sam <- draw(eusilcP, size = 25) getStrataSplit(sam, "gender") getStratumValues(sam, "gender")