Learn R Programming

mmod (version 1.3.2)

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, na.rm = TRUE)

Arguments

x
numeric vector
na.rm
logical remove NAs prior or calculation

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