Learn R Programming

birk (version 1.3.0)

geom_mean: Geometric Mean

Description

Computes the geometric mean of a vector, x. It is a wrapper for exp(mean(log(x))).

Usage

geom_mean(x, add0.001 = FALSE, ignore_neg = FALSE, ...)

Arguments

x
a numeric vector or an R object which is coercible to one by as.vector(x, "numeric”).
add0.001
logical. Should a small constant (0.001) be added to avoid issues with zeroes?
ignore_neg
logical. Should negative values be ignored to avoid NaNs?
...
further arguments passed to mean.

encoding

UTF-8

See Also

mean

Examples

Run this code
geom_mean(1:10)
geom_mean(0:10)
geom_mean(0:10, add0.001 = TRUE)
geom_mean(-10:10, add0.001 = TRUE, ignore_neg = TRUE)

Run the code above in your browser using DataLab