powered by
Compute the weighted mean.
weightedMean(x, weights = NULL, na.rm = FALSE)
The weighted mean of values in x is returned.
x
a numeric vector.
an optional numeric vector giving the sample weights.
a logical indicating whether missing values in x should be omitted.
Andreas Alfons
This is a simple wrapper function calling weighted.mean if sample weights are supplied and mean otherwise.
weighted.mean
mean
incMean
data(eusilc) weightedMean(eusilc$eqIncome, eusilc$rb050)
Run the code above in your browser using DataLab