Usage
geom_mean(x, na.rm = FALSE)
Arguments
- x
vector to compute geometric mean of
- na.rm
boolean to remove NA from vector in calcualtion. Default is False
Value
geometric mean of input vector x
Details
The geometric mean is calculated as:
$$GM = \exp\left(\mathbb{E}[\log(x)]\right)$$
Examples
geom_mean(c(1, 2, 3, 2, 1))
#> [1] 1.643752