View source: R/aggregate_weights.R
aggregate_weights | R Documentation |
Aggregates discrete values together with their weights into a data frame or tibble.
aggregate_weights(y, weights, sum_to_one = FALSE)
y |
Vector of outcomes. |
weights |
Vector of weights, one for each of |
sum_to_one |
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
.
Data frame with the following columns:
location
: Increasing vector of unique values of y
having positive weight.
size
: Weights corresponding to each outcome.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.