Drop-in replacement for stats::weighted.mean() that defaults to
na.rm = TRUE and warns when missing values are removed.
Unlike base R, missing values in either x or w cause the
corresponding pair to be removed.
Arguments
- x
A numeric vector of values.
- w
A numeric vector of weights the same length as
x.- ...
Additional arguments passed to
stats::weighted.mean().- na.rm
Logical. Should missing values be removed? Default
TRUE.- all_na
Character. What to do when all values are NA:
"error"(default) throws an error,"base"returns what base R does withna.rm = TRUE,"na"returnsNA. IfNULL, usesgetOption("tidyna.all_na", "error").