This function weights the variable x by
a specific vector of weights. It's an
alternative weight calculation to weight,
though weight usage is recommended.
Usage
weight2(x, weights)
Arguments
x
(Unweighted) variable
weights
Vector with same length as x, which
contains weight factors. Each value of x has a
specific assigned weight in weights.
Value
The weighted x.
Details
This function sums up all weights values of the associated
categories of x, whereas the weight function
uses a xtabs formula to weight cases. Thus, this function
may return a vector of different length than x.