Learn R Programming

RVAideMemoire (version 0.9-79)

wmean: 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.

Examples

Run this code
# NOT RUN {
mean(1:10)
wmean(1:10,w=10:1)
# }

Run the code above in your browser using DataLab