# Harmonic means are suitable for ratios
tmp = c(33/1, 23/1)
harmonic_mean(tmp)
geometric_mean(tmp)
mean(tmp)
# Example with weights
harmonic_mean(c(33/1, 23/1), weights= c(.2, .8))
# If Jack travels outbound at 1 mph, and returns at 10 miles an hour, what is his average speed?
harmonic_mean(c(1,10)) # 1.81 mph
Run the code above in your browser using DataLab