R/cv.R

#'@title coefficient of variation
#'
#'@description Compute the coefficient of variation
#'@author Oscar Ramirez Alan (\email{osoramirez@@gmail.com}).
#'@param x is a numeric value, could be a  a vector or data.frame
#'@export cv
#'@keywords cv
#'@return cv
#'@export cv
#'
#'@examples
#'set.seed(12345)
#'x<-rnorm(25,2,3)
#'cv(x)
#'

cv <- function(x)
{
  options(digits=3)
  data <- na.omit(x)
  sqrt(var(data,na.rm=TRUE))/mean(data,na.rm=TRUE)
  }
osoramirez/resumeRdesc documentation built on May 31, 2019, 5:13 p.m.