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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.