geoMean: Geometric mean

geoMeanR Documentation

Geometric mean

Description

Geometric mean, with optional removal of NA's and propagation of zeros.

Usage

geoMean(x, prop0 = FALSE, na.rm = TRUE)

Arguments

x

Numeric list.

prop0

Logical, if FALSE (default) then if any value in x equals 0 then the output will be zero. If TRUE, then zero values will be removed before calculation of the geometric mean.

na.rm

Logical, if TRUE then remove NA values first.

Details

Adapted from Paul McMurdie on StackOverflow.

Value

Numeric.

Examples


x <- seq(0.01, 1, by=0.01)
mean(x)
geoMean(x)
x <- seq(0, 1, by=0.01)
mean(x)
geoMean(x)
geoMean(x, prop0=TRUE)


adamlilith/statisfactory documentation built on Jan. 3, 2024, 10:37 p.m.