[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) - Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._