| geoMean | R Documentation |
Calculates the geometric mean
geoMean(x, na.rm = FALSE)
x |
a vector. Matrices are allowed. |
na.rm |
logical; should NA values be removed? |
If x has any NA values then geoMean will return
NA just like mean unless na.rm = TRUE is specified.
Otherwise, the geometric mean of x is returned. If the input only
has NA values then NA is returned as well.
Samuel Leung, Derek Chiu
set.seed(1)
x <- rexp(100, rate = 0.5)
y <- rexp(100, rate = 0.3)
y[3] <- NA
geoMean(x)
geoMean(y)
geoMean(y, na.rm = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.