cv: Compute the percentage coefficient of variation, (in a scale...

View source: R/stats-utility.R

cvR Documentation

Compute the percentage coefficient of variation, (in a scale from 0 to 100).

Description

The coefficient of variation is computed as: \frac{\sigma(x)}{\bar{x}}*100, with:

  • \sigma(x): standard deviation of x

  • \bar{x}: arithmetic mean of x

Usage

cv(x, na.rm = FALSE)

Arguments

x

Numeric vector.

na.rm

Logical, should NA value(s) be removed (FALSE by default)?

Value

Numeric vector of length 1 with coefficient of variation.

Author(s)

Laure Cougnaud

See Also

Other stats utility functions: geomCV(), geomMean(), geomSD(), geomSE(), se()

Examples

# coefficient of variation of normal distribution tends to 100%
cv(rnorm(n = 1000, mean = 1, sd = 1))

inTextSummaryTable documentation built on Sept. 12, 2023, 5:06 p.m.