R/RcppExports.R

Defines functions gmeanRow gmean

Documented in gmean gmeanRow

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Geometric mean of a vector
#' @param vec A vector of values with length \code{n}
#' @description Compute geometric mean of a vector
#'     using \code{exp(mean(log(.x)))} format
#' @return A numeric value of the
#'     geometric mean of the vector \code{vec}
#' @examples
#' ex <- abs(rnorm(10))
#' gmean(ex)
#' @export
gmean <- function(vec) {
    .Call(`_CBEA_gmean`, vec)
}

#' Geometric mean of rows of a matrix
#' @param X A numeric matrix with \code{n} rows and \code{p} columns
#' @description This function computes the geometric
#'     mean by row of a numeric matrix
#' @return A numeric vector of the geometric
#'     mean of the matrix \code{X} with length \code{n}
#' @examples
#' ex <- matrix(rnorm(100), nrow = 10, ncol = 10)
#' ex <- abs(ex)
#' gmeanRow(ex)
#' @export
gmeanRow <- function(X) {
    .Call(`_CBEA_gmeanRow`, X)
}
qpmnguyen/teaR documentation built on April 4, 2022, 7:26 p.m.