From Kurt.Hornik@ci.tuwien.ac.at  Wed Jan  7 07:41:45 1998
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Wed, 7 Jan 1998 08:41:45 +0100
Subject: unary !
In-Reply-To: <199801050749.IAA00426@sophie.ethz.ch>
References: <Pine.SOL.3.95.980104105608.7341B-100000@gorn>
 <199801050749.IAA00426@sophie.ethz.ch>
Message-ID: <199801070741.IAA08682@pc25.none>

>>>>> Martin Maechler writes:

> [spill over from  R-core]
>>>>> "TL" == Thomas Lumley <thomas@biostat.washington.edu> writes:

TL> On Sun, 4 Jan 1998, Kurt Hornik wrote:
>>> Another thing I noticed when playing with chron is that apparently
>>> code like if (!(length(value)) works in S but not in R.  The error
>>> in R is unary ! is only defined for logical vectors
>>> 
>>> I assume that this is a bug and not a feature (although the code in
>>> src/main/logic.c makes me wonder ...).

TL> I complained about this more than a year ago and I thought we (or
TL> in those days R+R) had decided it was a feature -- I just explained
TL> to someone on r-help that it was one of the deliberate
TL> incompatibilities that ! didn't work on numerics.

> Yes, positively.  We've discussed this quite a bit, and
> this was defined to be a feature long ago.

> The proper (non C-hacker but normal-user readable) way is to test for

> 	if(length(vector) == 0)

O.k.  I will add this to the FAQ but I am still not convinced.  If I may
e.g. do

R> 0 & 0
[1] FALSE
R> 1 | 0
[1] TRUE

then why can't !0 be TRUE?

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


unary !
Kurt Hornik