Last chance! 50% off unlimited learning
Sale ends in
sign
returns a vector with the signs of the corresponding
elements of x
(the sign of a real number is 1, 0, or
Note that sign
does not operate on complex vectors.
sign(x)
a numeric vector
This is an internal generic primitive function: methods
can be defined for it directly or via the
Math
group generic.
# NOT RUN {
sign(pi) # == 1
sign(-2:3) # -1 -1 0 1 1 1
# }
Run the code above in your browser using DataLab