geo.meanR Documentation

Calculate geometric mean and round

Description

Calculate the geometric mean

Usage

geo.mean(num, na.rm = TRUE, neg.rm = TRUE, round = 2)

Arguments

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

Value

the geometric mean of a set of numbers

Examples

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)