powered by
Scale a vector of weights so that they sum to 1.
scale_weights(x)
A numeric vector that sums to 1. If there are NAs in x then the result sums 1 to if these values are removed.
NA
x
[numeric >= 0] A positive numeric vector with at least one non-zero element.
[numeric >= 0]
Other math functions: emean(), gmean(), nested_gmean(), transmute_weights(), transmute_weights2(), update_weights()
emean()
gmean()
nested_gmean()
transmute_weights()
transmute_weights2()
update_weights()
scale_weights(1:5) scale_weights(c(1:5, NA))
Run the code above in your browser using DataLab