gm_own: Calculate geometric mean of a vector.

Description Usage Arguments Value Examples

View source: R/diff_tests.R

Description

Calculate geometric mean of a vector.

Usage

1
gm_own(x, na.rm = FALSE, zeros.count = TRUE)

Arguments

x

Numeric vector

na.rm

Should NA values be removed? If FALSE, you get NA when "x" data contains NA. If TRUE NA gets ignored (treated as 1 in multiplication). (but NOTE these zeros always count also when zero.count = FALSE)

zeros.count

Should I count 0's when estimating the mean?

Value

Geometric mean of elements in x

Examples

1
2
3
4
5
6
7
x <- c(1,64,0)

# Returns 64^3 = 4
gm_own(x, zeros.count = TRUE)

# Returns 64^2 = 8
gm_own(x, zeros.count = FALSE)

TBrach/MicrobiomeX documentation built on April 19, 2018, 12:25 a.m.