normalize: Normalize a vector

Description Usage Arguments Value References See Also Examples

Description

Divide all given vectors with the absolute sum of all the elements in the vector, such that the sum of the result equals 1, that is if you take the absolute value of the results. In other words, you can give negative values.

Usage

1
normalize(num_vector)

Arguments

num_vector

numeric vector you want to normalize.

Value

A normalized vector, i.e. another numeric vector with the sum of its values equaling 1.

References

ProductConfig Github page: https://github.com/avilesd/productConfig

See Also

Other GetFunctions: benefitToCostAttr, getAllUserIds, getAttrValues, getDefaultRefps, getRoundsById, getTableById, get_attrs_ID

Examples

1
2
3
normalize(c(1,2,1,2)) #Returns: [1] 0.1666667 0.3333333 0.1666667 0.3333333
normalize(c(1,2,-1,-2)) #Returns: [1] 0.1666667 0.3333333 0.1666667 -0.3333333
normalize(c(10,20,30,40,50))

avilesd/productConfig documentation built on May 11, 2019, 4:08 p.m.