## generate random lognormal data
d <- rlnorm(500,meanlog=0,sdlog=1)
# d has a mean on log scale of 0; thus, gm should be exp(0)~=1
# d has a sd on log scale of 1; thus, gsd should be exp(1)~=2.7
geomean(d)
geosd(d)
if (FALSE) {
## Demonstrate handling of zeros and negative values
x <- seq(-1,5)
# this will given an error
geomean(x)
# this will only give a warning, but might not be what you want
geomean(x,zneg.rm=TRUE)
}
Run the code above in your browser using DataLab