Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

weighted_mean

Weighted Mean


Description

Returns 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 non-negative, non-missing case weights.

...

Further arguments passed to mean or weighted.mean.

Value

A length-one numeric vector.

See Also

Examples

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

MetricsWeighted

Weighted Metrics, Scoring Functions and Performance Measures for Machine Learning

v0.5.2
GPL (>= 2)
Authors
Michael Mayer [aut, cre, cph], Christian Lorentzen [ctb, rev]
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.