weighted_mean | R Documentation |
Returns the weighted mean of a numeric vector.
In contrast to stats::weighted.mean()
, w
does not need to be specified.
weighted_mean(x, w = NULL, ...)
x |
Numeric vector. |
w |
Optional vector of non-negative case weights. |
... |
Further arguments passed to |
A length-one numeric vector.
stats::weighted.mean()
weighted_mean(1:10)
weighted_mean(1:10, w = NULL)
weighted_mean(1:10, w = 1:10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.