| geo.mean | R Documentation |
Calculate the geometric mean
geo.mean(num, na.rm = TRUE, neg.rm = TRUE, round = 2)
num |
vector of numbers |
na.rm |
remove NAs from the vector |
neg.rm |
remove negative values from the vector |
round |
round result to decimal place |
the geometric mean of a set of numbers
num1 <- sample(300:3000,10) #get the geometric mean, excluding all negatives and round to 2 geo.mean(num1) #or geo.mean(num1) #get geometric mean, but round the final value to 5 decimal places geo.mean(num1, round = 5)