calcGM {PBSmodelling}R Documentation

Calculate the Geometric Mean

Description

Calculate the geometric mean of a numeric vector, possibly excluding zeros and/or adding an offset to compensate for zero values.

Usage

calcGM(x, offset = 0, exzero = TRUE)

Arguments

x vector of numbers
offset value to add to all components, including zeroes
exzero if T, exclude zeroes (but still add the offset)

Value

geometric mean of the modified vector x + offset

Note

NA values are automatically removed from x

Examples

calcGM(c(0,1,100))
calcGM(c(0,1,100),offset=0.01,exzero=FALSE)

[Package PBSmodelling version 0.60 Index]