Learn R Programming

nlmixr2autoinit (version 1.0.0)

trimmed_geom_mean: Computes the trimmed geometric mean

Description

Computes the trimmed geometric mean of a numeric vector

Usage

trimmed_geom_mean(x, trim = 0, na.rm = TRUE)

Value

A numeric value representing the trimmed geometric mean. Returns NA if no values remain after trimming.

Arguments

x

A numeric vector containing the values for geometric mean calculation.

trim

A numeric value between 0 and 0.5 indicating the proportion of values to be trimmed from each end of the vector. Default is 0.

na.rm

Logical value indicating whether missing values should be removed before computation. Default is TRUE.

Examples

Run this code
x <- c(1, 2, 3, 4, 5, 100)
trimmed_geom_mean(x, trim = 0.05)

Run the code above in your browser using DataLab