Learn R Programming

inTextSummaryTable (version 3.3.2)

geomMean: Compute geometric mean.

Description

The geometric mean is computed as: \(\exp(\bar{log(x)})\), with:

  • log: natural logarithm

  • \(\bar{log(x)}\): arithmetic mean of log(x)

Usage

geomMean(x, na.rm = FALSE)

Value

Numeric vector of length 1 with geometric mean.

Arguments

x

Numeric vector.

na.rm

Logical, should NA value(s) be removed (FALSE by default)?

Author

Laure Cougnaud

See Also

Other stats utility functions: cv(), geomCV(), geomSD(), geomSE(), se()

Examples

Run this code
# geometric mean of a big sample from log normal distribution
# tends to the mean of the distribution:
geomMean(rlnorm(n = 1000, meanlog = 0, sdlog = 1))

Run the code above in your browser using DataLab