signp {cwhmath}R Documentation

Sign Function

Description

sign returns a vector with the signs of the corresponding elements of x (the sign of a real number is 1, 1, or -1 if the number is positive, zero, or negative, respectively).

Note that sign does not operate on complex vectors.

Usage

  signp(x)

Arguments

x a numeric vector

Author(s)

Christian W. Hoffmann, christian.hoffmann@wsl.ch,
http://www.wsl.ch/staff/christian.hoffmann

See Also

sign

Examples

signp(-2:3)# -1 -1 1 1 1 1
(m <- matrix(rnorm(9),3,3))
m %*% diag(signp(diag(m)))

[Package cwhmath version 2.0 Index]