Function calculating the geometric mean of numeric vectors

geometric_mean(x, na.rm = FALSE)

Arguments

x

A numeric vector

na.rm

Should NA values be ignored

Value

The geometric mean.

Examples

geometric_mean(c(1,3, 9))
#> [1] 3
geometric_mean(c(1,3, NA))
#> [1] NA
geometric_mean(c(1,3, NA), na.rm = TRUE)
#> [1] 1.732051