dae (version 3.1-23)

harmonic.mean: Calcuates the harmonic mean.

Description

A function to calcuate the harmonic mean of a set of nonzero numbers.

Usage

harmonic.mean(x)

Arguments

x

An object from whose elements the harmonic mean is to be computed.

Value

A numeric. Returns Inf if x contains a value close to zero

Details

All the elements of x are tested as being less than daeTolerance, which is initially set to .Machine$double.eps ^ 0.5 (about 1.5E-08). The function set.daeTolerance can be used to change daeTolerance.

Examples

Run this code
# NOT RUN {
y <- c(seq(0.1,1,0.2))
harmonic.mean(y)
# }

Run the code above in your browser using DataLab