harmonic.mean: Harmonic Mean

View source: R/harmonic.mean.R

harmonic.meanR Documentation

Harmonic Mean

Description

Calculate the harmonic mean of a set of numbers.

Usage

harmonic.mean(x, w = NULL, na.rm = FALSE)

Arguments

x

a numeric vector.

w

an optional numerical vector of weights the same length as x.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Note

If zeroes are present in x, function will return approximation with a warning. In this case, weights will not be used.

Author(s)

Eric Archer eric.archer@noaa.gov

Examples

x <- rlnorm(100)
mean(x)
median(x)
harmonic.mean(x)


swfscMisc documentation built on Sept. 8, 2023, 5:55 p.m.