R/weighted_mean.R

Defines functions weighted_mean

Documented in weighted_mean

## File Name: weighted_mean.R
## File Version: 9.15


# weighted mean
weighted_mean <- function( x, w=rep(1,length(x)), select=NULL )
{
    res <- tam_weighted_stats_select(x=x, w=w, select=select)
    x <- res$x
    w <- res$w
    res <- sum( x * w ) / sum(w)
    return(res)
}

Try the TAM package in your browser

Any scripts or data that you put into this service are public.

TAM documentation built on Aug. 29, 2022, 1:05 a.m.