Weighted Mean, Median, SD, and MAD
Usage
weighted_mean(x, weights = NULL, remove_na = TRUE, verbose = TRUE, ...)
weighted_median(x, weights = NULL, remove_na = TRUE, verbose = TRUE, ...)
weighted_sd(x, weights = NULL, remove_na = TRUE, verbose = TRUE, ...)
weighted_mad(
x,
weights = NULL,
constant = 1.4826,
remove_na = TRUE,
verbose = TRUE,
...
)Arguments
- x
an object containing the values whose weighted mean is to be computed.
- weights
A numerical vector of weights the same length as
xgiving the weights to use for elements ofx. Ifweights = NULL,xis passed to the non-weighted function.- remove_na
Logical, if
TRUE(default), removes missing (NA) and infinite values fromxandweights.- verbose
Show warning when
weightsare negative?- ...
arguments to be passed to or from methods.
- constant
scale factor.
