x <- runif(5)
Gmean(x)
m <- matrix(runif(50), nrow = 10)
apply(m, 2, Gmean)
sapply(as.data.frame(m), Gmean)
# ......................................................
# example in https://www.stata.com/manuals13/rameans.pdf
x <- c(5,4,-4,-5,0,0,NA,7)
# positives only
Gmean(x[x>0], na.rm=TRUE, conf.level=0.95)
# add 5 to original values and remove zeros
Gmean(NAIfZero(x+5), na.rm=TRUE, conf.level = 0.95)
Run the code above in your browser using DataLab