r harmonic mean code example
Example: harmonic mean in r
# using psych package
library(psych)
harmonic.mean(x,na.rm=TRUE,zero=TRUE)
# base R
a = c(vector)
1/mean(1/a) #harmonic mean calculation
# using psych package
library(psych)
harmonic.mean(x,na.rm=TRUE,zero=TRUE)
# base R
a = c(vector)
1/mean(1/a) #harmonic mean calculation