| weighted_mean_univariate | R Documentation |
Calculation of weighted mean when the target is univariate
weighted_mean_univariate(x, weights)
x |
vector of values |
weights |
vector of weights |
the weighted mean of x
x <- c(0.4, 0.2, 0.5, 0.9, 1.4)
w <- c(3, 2, 5, 1, 2)
weighted_mean_univariate(x = x,
weights = w)
# returns the same using weighted.mean(x, w) function in R
weighted.mean(x, w)
weighted_mean_univariate(x = x,
weights = rep(1, 5))
#returns the same using standard mean(x) function in R
mean(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.