R-beta: Precedence of ~ and |

Douglas Bates bates at stat.wisc.edu
Wed Apr 2 21:12:32 CEST 1997


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 at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the R-help mailing list