Skip to contents

Computation of the mean (arithmetic,geometric and harmonic).

Usage

calc_mean(
  x,
  type = c("arithmetic", "geometric", "harmonic"),
  trim = NULL,
  weight = NULL
)

Arguments

x

A numeric vector

type

A character single value

trim

A numeric single value, that will be the fraction of data to be trimmed from both ends

weight

A numeric vector, that will be the weights used for the weighted the arithmetic mean

Value

A numeric single value with the computed mean.

Examples


x <- rexp(100,.5)

calc_mean(x,"geometric")
#> [1] 1.20635