Scale a vector of weights so that they sum to 1.
Value
A numeric vector that sums to 1. If there are NAs in x then the result
sums 1 to if these values are removed.
See also
Other math functions:
emean(),
gmean(),
nested_gmean(),
transmute_weights(),
transmute_weights2(),
update_weights()
Examples
scale_weights(1:5)
#> [1] 0.06666667 0.13333333 0.20000000 0.26666667 0.33333333
scale_weights(c(1:5, NA))
#> [1] 0.06666667 0.13333333 0.20000000 0.26666667 0.33333333 NA
