Normalize a vector by max absolute value

normalize_vector(x)

Arguments

x

numeric vector, a vector of numbers

Value

numeric vector, the vector divided by the largest absolute value in the vector

Examples

a <- c(1,2,3) normalize_vector(a)
#> [1] 0.3333333 0.6666667 1.0000000