Compute Weighted Mean
USAGE:
weighted.mean(y, w, na.rm=FALSE)
ARGUMENTS:
- y
-
a numeric vector.
Missing values (NA) are allowed.
- w
-
a numeric vector of weights (default is a vector of 1s).
- na.rm
-
a logical flag; if
TRUE
missing value are removed before
computing the weighted mean.
VALUE:
The weighted mean of
y
is returned.