\Header{weighted.mean}{Weighted Arithmetic Mean}
\keyword{univar}{weighted.mean}
\begin{Description}\relax
Compute a weighted mean of a numeric vector.\end{Description}
\begin{Usage}
\begin{verbatim}
weighted.mean(x, w, na.rm=FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a numeric vector containing the values
whose mean is to be computed.
\item[\code{w}] a vector of weights the same length as \code{x} giving
the weights to use for each element of \code{x}.
\item[\code{na.rm}] a logical value indicating whether \code{NA}
values in \code{x} should be stripped before the computation proceeds.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
If \code{w} is missing then all elements of \code{x} are
given the same weight.

Missing values in \code{w} are not handled.\end{Details}
\begin{SeeAlso}\relax
\code{\Link{mean}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## GPA from Siegel 1994
wt <- c(5,  5,  4,  1)/15
x <- c(3.7,3.3,3.5,2.8)
xm <- weighted.mean(x,wt)
\end{ExampleCode}
\end{Examples}

