wmean: Weighted arithmetic mean

View source: R/wmean.R

wmeanR Documentation

Weighted arithmetic mean

Description

Computes the weighted arithmetic mean of a vector.

Usage

wmean(x, w = rep(1, length(x)), na.rm = TRUE)

Arguments

x

numeric vector.

w

numeric vector of weights.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Author(s)

Maxime HERVE <maxime.herve@univ-rennes1.fr>

Examples

mean(1:10)
wmean(1:10,w=10:1)

RVAideMemoire documentation built on Nov. 6, 2023, 5:07 p.m.