geomean: Geometric mean

View source: R/geomean.R

geomeanR Documentation

Geometric mean

Description

Calculate the geometric mean of a numeric vector

Usage

geomean(x = NULL, zero_or_neg_convert_to = NA)

Arguments

x

a numeric vector

zero_or_neg_convert_to

the value to which zero or negative values will be converted to. If zero_or_neg_convert_to == NA, zero or negative values will be converted to NA values and thus be excluded when calculating the geometric mean. (default = NA)

Examples

## Not run: 
geomean(c(1, 4))
geomean(c(1, 100))
geomean(c(1, 100, NA))
geomean(c(1, 100, NA, 0, -1, -2))
geomean(
x = c(1, 100, NA, 0, -1, -2),
zero_or_neg_convert_to = 1)
geomean(c(1, 100, NA, 1, 1, 1))

## End(Not run)

kim documentation built on Oct. 9, 2023, 5:08 p.m.

Related to geomean in kim...