NA and help page for "&" and "|"

Jonathan Rougier J.C.Rougier@durham.ac.uk
Tue, 20 Aug 2002 14:49:53 +0100


Hi everyone,

Can I suggest an addition to the help page for logical AND and OR,
indicating the behaviour of NA (which is currently not mentioned at
all).  I think something simple like an extra paragraph in Details, eg

\code{NA} is a valid logical object.  Where a component of \code{x} or
\code{y} is \code{NA}, the result will be \code{NA} if the outcome is
ambiguous.  In other words \code{NA & TRUE} evaluates to \code{NA}, but
\code{NA & FALSE} evaluates to \code{FALSE}.  See the examples below.

And so it might also be a good idea to add a truth-table to the
examples, eg

# construct truth table for logical &

x <- c(NA, FALSE, TRUE)
names(x) <- as.character(x)
outer(x, x, "&")

Cheers, Jonathan.

-- 
Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._