swfscMisc (version 1.6.5)

harmonic.mean: 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.

Author

Eric Archer eric.archer@noaa.gov

Examples

Run this code
x <- rlnorm(100)
mean(x)
median(x)
harmonic.mean(x)

Run the code above in your browser using DataLab