gm: Calculate geometric mean

View source: R/statistics.R

gmR Documentation

Calculate geometric mean

Description

Calculate geometric mean

Usage

gm(x, na.rm = FALSE, neg.rm = FALSE)

Arguments

x

Numeric vector.

na.rm

Flag for removing NA values (defaults to FALSE).

neg.rm

Flag for removing negative or zero values (defaults to FALSE).

Value

The geometric mean. NA is returned if there are any non-positive elements in x.

Author(s)

Justin Wilkins, justin.wilkins@occams.com

Examples

gm(c(0.5, 7, 8, 5))


pmxTools documentation built on Aug. 25, 2025, 5:12 p.m.