R/geomean.R

Defines functions geomean

Documented in geomean

#' Geometric Mean
#'
#' Calculate geometric mean.
#'
#' @param x a numeric vector.
#' @param na.rm whether \code{NA} values should be stripped before the
#'        computation proceeds.
#'
#' @return Geometric mean as a vector.
#'
#' @export

geomean <- function(x, na.rm=FALSE)
{
  exp(mean(log(x), na.rm=na.rm))
}
arnima-github/arni documentation built on Oct. 28, 2023, 6:18 p.m.