scale_weights: Scale weights

View source: R/weights.R

scale_weightsR Documentation

Scale weights

Description

Scale a vector of weights so that they sum to 1.

Usage

scale_weights(x)

Arguments

x

A strictly positive numeric vector.

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

grouped() to make this function applicable to grouped data.

Other weights: factor_weights(), transmute_weights()

Examples

scale_weights(1:5)


gpindex documentation built on Nov. 15, 2023, 9:06 a.m.