R: Weighted mean

weightedMean {laeken} | R Documentation

## Weighted mean

### Description

Compute the weighted mean.

### Usage

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

### 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.

### Details

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

### Value

The weighted mean of values in `x` is returned.

### Author(s)

Andreas Alfons

### See Also

`incMean`

### Examples

    data(eusilc)
    weightedMean(eusilc$eqIncome, eusilc$rb050)

[Package laeken version 0.4.6 Index]