This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/weighted.mean.html
weighted.mean {base}R Documentation

Weighted Arithmetic Mean

Description

If w is missing then all elements of x are given the same weight.

Missing values in w are not handled.

Usage

weighted.mean(x, w, na.rm=FALSE)

Arguments

x

a numeric vector containing the values whose mean is to be computed.

w

a vector of weights the same length as x giving the weights to use for each element of x.

na.rm

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

See Also

mean

Examples

## GPA from Siegel 1994
wt<- c(5/15,5/15,4/15,1/15)
x <- c(3.7,3.3,3.5,2.8)
xm <- weighted.mean(x,wt)

[Package base version 0.60 ]