Learn R Programming

beadplexr (version 0.5.0)

harmonic_mean: Calculate harmonic mean

Description

Calculate harmonic mean

Usage

harmonic_mean(.x)

Value

A single numeric value

Arguments

.x

A numeric to take the harmonic mean of

Mean calculation

The calculation of the harmonic mean is as follows: $$ n\frac{1}{\sum_{i=1}^n \frac{1}{x_i}} $$

NAs are removed before calculation

Examples

Run this code
beadplexr:::harmonic_mean(runif(10))

Run the code above in your browser using DataLab