R/geometric_mean.R

Defines functions geometric_mean

#' geometric_mean
#'
#' @param x [^[numeric]] A `numeric` or a `numeric` vector.
#'
#' @keywords internal
#' @usage NULL
#' @noRd
#'
#' @return [^[numeric]]
geometric_mean <- function(x) {
  x[x == 0] <- 1
  exp(mean(log(x)))
}
mcanouil/NACHO documentation built on Feb. 1, 2024, 12:35 p.m.