Learn R Programming

pmxTools (version 1.5)

gm: Calculate geometric mean

Description

Calculate geometric mean

Usage

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

Value

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

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).

Author

Justin Wilkins, justin.wilkins@occams.com

Examples

Run this code
gm(c(0.5, 7, 8, 5))

Run the code above in your browser using DataLab