geo.cvR Documentation

Calculate geometric coefficient of variation and round

Description

Calculate the coefficient of variation and round

Usage

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

Arguments

num

vector of numbers

na.rm

remove NAs from the vector

neg.rm

remove negative values from the vector

pct

TRUE or FALSE. should result be in percent

round

round result to decimal place

Value

the geometric cv of a set of numbers

Examples

#simulate numbers using a fixed seed
num1 <- number(n = 1115,max.digits = 4, seed = 10)

#get geometric CV, represent as percent and round to 2 decimal places
geo.cv(num1,round = 2) # result: 60.61%

#or round to 3 decimal places
geo.cv(num1,round = 3) # result: 60.609%

#by default, the above examples return a CV%
#if you do not want the result as percentage, specify "pct"
geo.cv(num1,pct = FALSE) # result: 0.61