[Rd] (NA || x) and (NA && y) {another "bug" } (PR#749)

maechler@stat.math.ethz.ch maechler@stat.math.ethz.ch
Wed, 29 Nov 2000 16:17:16 +0100 (MET)


>>>>> "MM" == Martin Maechler <maechler@stat.math.ethz.ch> writes:

>>>>> "TL" == Thomas Lumley <thomas@biostat.washington.edu> writes:

    TL> However, it would also be reasonable for NA || B to evaluate B and
    TL> return TRUE or NA depending on the value.  This is what S-PLUS 5
    TL> does, so at least it's an incompatibility.

    TL> The R documentation says 

    TL> The longer form [ie ||] evaluates left to right examining only the
    TL> first element of each vector.  Evaluation 
    TL> proceeds only until the result is determined. 

    TL> which at least seems incomplete as NA | TRUE gives TRUE, but
    TL> NA || TRUE gives an error.

    MM> Looks over-cautious to me as well.

    ........

    MM> 2) really do the same as S, not only Splus 5.x, but also 3.4 which
    MM> used to be our prototype, namely

    >> NA || TRUE
    MM> [1] TRUE
    >> NA && FALSE
    MM> [1] FALSE
    >> NA && TRUE
    MM> [1] NA
    >> NA || FALSE
    MM> [1] NA

    MM> The advantage of "1)" is to catch programming errors early in some
    MM> cases, however for consistency (with "|" and "&") and
    MM> compatibility, I'm voting for a change to "2)" behaviour.

This is now in "R-devel" aka  ``R 1.2 to be''  (slightly less than 20 days)

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._