nr.sign.chg: Number of Sign Changes in Sequence

View source: R/misc-goodies.R

nr.sign.chgR Documentation

Number of Sign Changes in Sequence

Description

Compute the number of sign changes in the sequence y.

Usage

nr.sign.chg(y)

Arguments

y

numeric vector.

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.

Author(s)

Martin Maechler, 17 Feb 1993.

Examples

(y <- c(1:2,1:-1,0:-2))
nr.sign.chg(y)## = 1

sfsmisc documentation built on Aug. 10, 2023, 5:06 p.m.