Learn R Programming

inTextSummaryTable (version 3.3.2)

cv: 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)

Value

Numeric vector of length 1 with coefficient of variation.

Arguments

x

Numeric vector.

na.rm

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

Author

Laure Cougnaud

See Also

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

Examples

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

Run the code above in your browser using DataLab