R/geomean.R

Defines functions geomean

Documented in geomean

#' Computes the geometric mean
#'
#' @param x vector
#' @param na.rm should NAs be removed
#'
#' @return
#' @export
#'
#'
geomean <- function(x, na.rm = T) {
  exp(sum(log(x[combineAND(x > 0, x < Inf)]), na.rm = na.rm) / length(x))
}
nicohuttmann/htmnanalysis documentation built on Dec. 6, 2020, 3:02 a.m.