compute the weighted mean

Share:

Description

given a vector of values and a vector of weights, compute the weighted mean

Usage

1
weighted.mean(x, w, na.rm = FALSE)

Arguments

x

the vector of values

w

the vector of weights

na.rm

if TRUE, only consider elmeents of x that are not missing (and their corresponding entries in w). Defaults to FALSE.

Value

the weighted mean