Make input vector unit length, i.e. norm == 1

unit(vector)

Arguments

vector

a vector

Value

a unit length vector

Examples

unit(c(1,2,3))
#> [1] 0.2672612 0.5345225 0.8017837