powered by
y
nr.sign.chg(y)
(y <- c(1:2,1:-1,0:-2)) nr.sign.chg(y)## = 1
Run the code above in your browser using DataLab