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)))
}

Try the NACHO package in your browser

Any scripts or data that you put into this service are public.

NACHO documentation built on Aug. 8, 2023, 1:08 a.m.