weighted_mean: Weighted Mean

View source: R/statistics.R

weighted_meanR Documentation

Weighted Mean

Description

Returns the weighted mean of a numeric vector. In contrast to stats::weighted.mean(), w does not need to be specified.

Usage

weighted_mean(x, w = NULL, ...)

Arguments

x

Numeric vector.

w

Optional vector of non-negative case weights.

...

Further arguments passed to mean() or stats::weighted.mean().

Value

A length-one numeric vector.

See Also

stats::weighted.mean()

Examples

weighted_mean(1:10)
weighted_mean(1:10, w = NULL)
weighted_mean(1:10, w = 1:10)

MetricsWeighted documentation built on Nov. 16, 2023, 5:09 p.m.