wtd_mean: Compute weighted mean.

Description Usage Arguments Value Examples

Description

Compute weighted mean.

Usage

1
wtd_mean(x, weights = NULL, na.rm = TRUE)

Arguments

x

A numeric vector.

weights

A numeric vector of weights.

na.rm

Set to FALSE to suppress checking for NAs

Value

Returns scalar vector of length one.

Examples

1
2
3
4
5
## Not run: set.seed(1)
         x <- runif(500)
         wts <- sample(1:6, 500, TRUE)
         mn <- wtd_mean(x = x, weights = wts)
## End(Not run)

gerasy1987/usefulr documentation built on Aug. 31, 2021, 4:25 p.m.