Learn R Programming

twangMediation (version 1.2)

weighted_mean: Calculate a weighted mean.

Description

weighted_mean calculates a weighted mean, given a vector.

Usage

weighted_mean(x, weights, multiplier = NULL, na.rm = TRUE)

Value

numeric The weighted mean of the data.

Arguments

x

numeric The the data set

weights

numeric The weights

multiplier

An additional vector to multiply Default : NULL

na.rm

Whether to remove NA values. Default: TRUE