Library: | xplore |
See also: | abs |
Quantlet: | sign | |
Description: | Computes the sign function (0, -1, 1) for zeros, negative or positive values. |
Usage: | s = sign (x) | |
Input: | ||
x | array | |
Output: | ||
s | array containing signs for all values of x |
library("xplore") randomize(0) x = normal(2, 3) ~(0|0) sign(x)
Contents of s [1,] -1 1 -1 0 [2,] -1 -1 1 0