Learn R Programming

laeken (version 0.5.3)

weightedMean: Weighted mean

Description

Compute the weighted mean.

Usage

weightedMean(x, weights = NULL, na.rm = FALSE)

Value

The weighted mean of values in x is returned.

Arguments

x

a numeric vector.

weights

an optional numeric vector giving the sample weights.

na.rm

a logical indicating whether missing values in x should be omitted.

Author

Andreas Alfons

Details

This is a simple wrapper function calling weighted.mean if sample weights are supplied and mean otherwise.

See Also

incMean

Examples

Run this code
data(eusilc)
weightedMean(eusilc$eqIncome, eusilc$rb050)

Run the code above in your browser using DataLab