[R] Bug(?) in predict.tree() --- Evaluation order of Boolean operators

christian-za.keller@ubs.com christian-za.keller at ubs.com
Fri Feb 15 17:32:21 CET 2002


Dear Peter 

Thank you for your help.

>> It's an operator precedence issue. || has higher precedence than & in
>> S (-plus, 6.0 and 3.4), but lower in R.
>>
>> Try substitute(T||F&F)[[1]]
>>
>> I think we want to be compatible, but we'll not likely change it in
>> the 1.4.x series. However, a set of parentheses should help...

Note also that in R:
   > T || F & F
   [1] TRUE
   > F & F || T
   [1] TRUE
   > substitute(T || F & F)[[1]]
   ||
   > substitute(F & F || T)[[1]]
   ||

while in S-Plus:
   > T || F & F
   [1] F
   > F & F || T
   [1] T
   > substitute(T || F & F)[[1]]
    & 
   > substitute(F & F || T)[[1]]
    || 


Christian

------------------------------------------
Christian Keller
================
UBS AG
Analytical CRM UBS CH
Nüschelerstrasse 22, CH-8098 Zürich
Tel. +41-1-234 51 48, Fax. +41-1-234 26 83
christian-za.keller at ubs.com

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