sign_no_zero.RdGet binary sign of a variable, or array
sign_no_zero(x)
| x | a vector or array |
|---|
a vector or array telling if each element of x is
greater than or equal to zero. This array will be of the same
dimension as x, but with elements -1 for negative values of
x, and elements +1 for positive values of x
sign_no_zero(-2:2) #returns -1 -1 1 1 1#> [1] -1 -1 1 1 1