
Last chance! 50% off unlimited learning
Sale ends in
Compute contingency tables taking into account sample weights.
tableWt(x, weights = NULL, useNA = c("no", "ifany", "always"))
The (weighted) contingency table as an object of class table
,
an array of integer values.
a vector that can be interpreted as a factor, or a matrix or
data.frame
whose columns can be interpreted as factors.
an optional numeric vector containing sample weights.
a logical indicating whether to include extra NA
levels
in the table.
Andreas Alfons and Stefan Kraft
For each combination of the variables in x
, the weighted number of
occurence is computed as the sum of the corresponding sample weights. If
weights are not specified, the function table
is applied.
table
, contingencyWt
data(eusilcS)
tableWt(eusilcS[, c("hsize", "db040")], weights = eusilcS$rb050)
tableWt(eusilcS[, c("rb090", "pb220a")], weights = eusilcS$rb050,
useNA = "ifany")
Run the code above in your browser using DataLab