weighted_mean function

Calculate a weighted mean.

Calculate a weighted mean.

weighted_mean calculates a weighted mean, given a vector.

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

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

Returns

numeric The weighted mean of the data.

  • Maintainer: Dan McCaffrey
  • License: GPL-3
  • Last published: 2022-08-16

Useful links