harmonic_mean(x)
harmonic mean of vector
Calculate the harmonic mean of a numeric vector (will return NA if there are any negative numbers in the vector)
data(nancycats) pop.sizes <- table(pop(nancycats)) harmonic_mean(pop.sizes) [1] 12.96096