Learn R Programming

robCompositions (version 2.4.1)

norm1: Normalize a vector to length 1

Description

Scales a vector to a unit vector.

Usage

norm1(x)

Arguments

x

a numeric vector

Author

Matthias Templ

Examples

Run this code

data(expenditures)
i <- 1
D <- 6
vec <- c(rep(-1/i, i), 1, rep(0, (D-i-1)))

norm1(vec)

Run the code above in your browser using DataLab