R-alpha: ==NULL

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Fri, 2 May 97 11:28:11 +0200

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

    ThLu> On Thu, 1 May 1997, Martin Maechler wrote:
    >> >>>>> "Tom" == Thomas Lumley <thomas@biostat.washington.edu> writes:
    ThLu>    ^^^^^ Aaargh! Not "Tom", please.

Excuse me!

    >> ....

    >>  Is n't logical(0) more logical than NA ?

    ThLu> I didn't (previously) make any comment on this -- I only said
    ThLu> that NA was more logical than an error message.  However, the
    ThLu> advantage of returning NA is that NA | TRUE is TRUE, NA & FALSE
    ThLu> is FALSE, which doesn't happen with logical(0). Also, from a
    ThLu> compatibility point of view one of them is tested with is.na(),
    ThLu> the other with length(), so it can matter which one you use.  Of
    ThLu> course no-one should deliberately write code where it matters,
    ThLu> but these things happen.

Ok, given the above argument, returning NA is logical, too.
However, I'd also argue that  
	logical(0) | TRUE	-> TRUE
	logical(0) & FALSE      -> FALSE

	logical(0) & TRUE	-> logical(0)
	logical(0) | FALSE      -> logical(0)

    ThLu> It seems in fact that logical(0) | TRUE causes R to freeze
    ThLu> (R0.49, sparc solaris).


> logical(0) | TRUE
Warning in logical(0) | TRUE : longer object length
        is not a multiple of shorter object length
Floating exception
~~~~~~~~~~~~~~~~~~ [and 'core' dump]
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