R-beta: Precedence of ~ and |

Douglas Bates (bates@stat.wisc.edu)
Wed, 2 Apr 1997 13:12:32 -0600 (CST)


Message-Id: <m0wCVSm-000hh5C@franz.stat.wisc.edu>
Date: Wed, 2 Apr 1997 13:12:32 -0600 (CST)
From: Douglas Bates <bates@stat.wisc.edu>
To: r-testers@stat.math.ethz.ch
Subject: R-beta: Precedence of ~ and |

There appears to be a difference between S and R in the relative
precedence of the ~ and | operators.  This becomes important when you
try to enter formulas for conditioning expressions, such as those used
in trellis graphics functions.  (They are also used in the groupedData
classes that Jose' Pinheiro and I are developing which is where I
encountered this.)

In R:
> foo <- conc ~ time | Subject
Error: Object "Subject" not found

In S-plus 3.4:
> foo <- conc ~ time | Subject
> class(foo)
[1] "formula"
> length(foo)
[1] 3
> foo[[3]]
time | Subject
> length(foo[[3]])
[1] 3
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=