Learn R Programming

cooltools (version 2.33)

unitvector: Normalize vectors to unit length

Description

Computes unit vectors from one or more vectors.

Usage

unitvector(x)

Value

An object of the same type and dimensions as x, with each vector normalized to unit length. Zero vectors are returned unchanged.

Arguments

x

Numeric vector or matrix. If a matrix is supplied, each row is interpreted as a vector.

See Also

vectornorm