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

Martin Maechler Martin Maechler <>
Tue, 20 Aug 2002 17:29:42 +0200

>>>>> "JonR" == Jonathan Rougier <>
>>>>>     on Tue, 20 Aug 2002 14:49:53 +0100 writes:

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

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

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

    JonR> # construct truth table for logical &

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

Thanks a lot, Jonathan, for the helpful suggestions.
I'm adding these to R-devel.

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: