Number of Sign Changes in Sequence
nr.sign.chg.RdCompute the number of sign changes in the sequence y.
Value
an integer giving the number of sign changes in sequence y.
Note that going from positive to 0 to positive is not a sign change.
Examples
(y <- c(1:2,1:-1,0:-2))
#> [1] 1 2 1 0 -1 0 -1 -2
nr.sign.chg(y)## = 1
#> [1] 1