Rev 1358 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{Logic}\title{Logical Operators}\usage{! xx & yx && yx | yx || yxor(x, y)}\alias{!}\alias{&}\alias{&&}\alias{|}\alias{||}\alias{xor}\alias{Logic}\description{These operators act on logical vectors.\code{!} indicates logical negation (NOT).\code{&} and \code{&&} indicate logical AND and \code{|} and \code{||}indicate logical OR. The shorter form performs elementwisecomparisons in much the same way as arithmetic operators. The longerform evaluates left to right examining only the first element of eachvector. Evaluation proceeds only until the result is determined. Thelonger form is appropriate for programming control-flow.\code{xor} indicates elementwise exclusive OR.}\seealso{\code{\link{TRUE}} or \code{\link{logical}}.}\examples{y <- 1 + (x <- rpois(50, lambda=1.5) / 4 - 1)x[(x > 0) & (x < 1)] # all x values between 0 and 1if (any(x == 0) || any(y == 0)) "zero encountered"}\keyword{logic}