Merely convention.

NULL == 2  <==> logical(0), that is, a logical vector of length 0. It makes
sense (at least to me) that any(logical(0)) is FALSE, since no elements of
the vector are TRUE. all(logical(0)) is TRUE since no elements of the vector
are FALSE.

I think these are reasonable and fairly standard conventions, but even if
you disagree, they are certainly not worth making a fuss over and certainly
cannot be changed without breaking a lot of code, I'm sure. 

Bert Gunter
Nonclinical Statistics
7-7374

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Benilton Carvalho
Sent: Wednesday, November 29, 2006 2:21 PM
To: R-Mailingliste
Subject: [R] tests for NULL objects

Hi Everyone,

After searching the subject and not being successful, I was wondering  
if any you could explain me the idea behind the following fact:

all(NULL == 2)  ## TRUE
any(NULL == 2) ## FALSE

Thanks a lot,

Benilton

--
Benilton Carvalho
PhD Candidate
Department of Biostatistics
Johns Hopkins University

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to