Aggregates discrete values together with their weights into a data frame or tibble.
aggregate_weights(y, weights, sum_to_one = FALSE)Data frame with the following columns:
y: Increasing vector of unique values of y that have positive weight.
weight: Weights corresponding to each outcome.
Vector of outcomes.
Vector of weights, one for each of y.
These need not sum to one, but must not be negative and non-NA.
Logical; should the weights be normalized to sum to 1? Default is FALSE.
For a vector of outcomes y with a matching vector of weights,
aggregate_weights() provides a single non-zero, non-NA
weight per unique value of y.