Learn R Programming

mmod (version 1.01)

harmonic_mean: Harmonic mean

Description

Calculate the harmonic mean of a numeric vector (will return NA if there are any negative numbers in the vector)

Usage

harmonic_mean(x)

Arguments

x
numeric vector

Value

  • harmonic mean of vector

Examples

Run this code
data(nancycats)
pop.sizes <- table(pop(nancycats))
harmonic_mean(pop.sizes)

Run the code above in your browser using DataLab