Get the Sign of Elements of a Numeric Vector in R Programming – sign() Function
sign() function in R Language is used to find the sign of the elements of the numeric vector provided as argument. It does not work on complex vectors.
x represents numeric vector
Returns: 1 for Positive number and -1 for Negative Number
Sign of x: 1 Sign of y: -1
Sign of elements of vector x: 1 1 0 -1 1 -1 1 -1