geomean(x, na.rm = TRUE)
Based on some posts in a thread on Stackoverflow http://stackoverflow.com/questions/2602583/geometric-mean-is-there-a-built-in This function checks for negative values, removes NA values per default and returns 0 if at least one element of the vector is 0.
[1] 3[1] 3## Not run: geomean(c(1, -3, 9)) # returns an error