[R] a < b < c is alway TRUE

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jul 6 19:30:44 CEST 2001


On Fri, 6 Jul 2001 16:57:03 +0200, you wrote in message
<3B45EDDF.10565.D31FD5 at localhost>:

>> Why would you expect 1 > 1 to be True?
>i didnt't realize TRUE<-1
>
>i thought TRUE was something like INF or so, because normally the following is 
>false (like Duncan wrote):
>> In R like C, FALSE is 0 and TRUE is 1
>
>normally in C you define somewhat like
>#define FALSE ((unsigned long) 0)
>#define TRUE (~((unsigned long) 0))
>(ok, there are more aesthetic ways, you can use "signed",...)

Shows how much I know about C, I guess!  But I thought "0 < 1"
evaluates to 1 and "1 < 0" evaluates to 0 in C, so maybe I should have
said "false is 0 and true is 1".

Thomas makes good points:  R *does* have a logical type.  The problem
is that R tries really hard to make sense of statements by coercing
types to be compatible, to the extent that it ends up with nonsensical
results.  

I suppose it's a good thing that I'm allowed to write

 "4" < 5

(which you can't do in Pascal, Fortran, etc.).  Maybe we should extend
it so that I could also write this as 

 "vier" < "cinq"

and have it realize that this should evaluate to true in Switzerland,
to false in North America.

Duncan Murdoch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list