a < b < c is alway TRUE
----- Original Message ----- From: "Till Baumgaertel" <till.baumgaertel at epost.de> To: <r-help at stat.math.ethz.ch> Cc: "Uwe Ligges" <ligges at statistik.uni-dortmund.de> Sent: Friday, July 06, 2001 5:21 AM Subject: Re: [R] a < b < c is alway TRUE
3 < 2 < 1 # [1] TRUE ???
this is evaluated from left to right: (3<2)<1 3<2 = FALSE FALSE<1 = TRUE what's surprising is the following:
FALSE<1
[1] TRUE
FALSE>1
[1] FALSE
TRUE<1
[1] FALSE
TRUE>1
[1] FALSE because of symmetry i'd expect TRUE>1 to be TRUE.
TRUE is being treated as equal to 1, so TRUE >= 1, returns TRUE. However, non-zero values are treated as TRUE when coercing numerical values.
as.logical(c(-2,-1,-.5,0,.5,1,2))
[1] TRUE TRUE TRUE FALSE TRUE TRUE TRUE -Bill -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._