tableWt: Weighted cross tabulation

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Compute contingency tables taking into account sample weights.

Usage

1
tableWt(x, weights = NULL, useNA = c("no", "ifany", "always"))

Arguments

x

a vector that can be interpreted as a factor, or a matrix or data.frame whose columns can be interpreted as factors.

weights

an optional numeric vector containing sample weights.

useNA

a logical indicating whether to include extra NA levels in the table.

Details

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.

Value

The (weighted) contingency table as an object of class table, an array of integer values.

Author(s)

Andreas Alfons and Stefan Kraft

See Also

table, contingencyWt

Examples

1
2
3
4
data(eusilcS)
tableWt(eusilcS[, c("hsize", "db040")], weights = eusilcS$rb050)
tableWt(eusilcS[, c("rb090", "pb220a")], weights = eusilcS$rb050,
    useNA = "ifany")


Search within the simPop package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.