Skip to contents

Percentage of the Sum of Values

Usage

percentageOfSum(x, na.rm = TRUE)

Arguments

x

vector of numeric values

na.rm

passed to max

Value

100 * x / sum(x)

Examples

p <- percentageOfSum(1:10)
stopifnot(sum(p) == 100)