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

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 15 17:54:08 CET 2002


On Fri, 15 Feb 2002 christian-za.keller at ubs.com wrote:

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

Not true for S: see ?Syntax.  They are equal, so left to right applies
(as in each predict.tree the author intended, since I happen to know).

As far as I can see this is completely undocumented in R, and so I
consider it to be a bug.  It is not in the list of differences in the FAQ,
nor can I find it in the `R Language Definition'. The latter does have
an operator precedence table *but* it does not have || or && in it!
(Not that the `Definition' existed when package tree was written.)
It does suggest & has precedence over |, which again would be an
undocumented difference from S.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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