[R] changes to terms.formula in 2.3.x
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Tue Jun 20 18:37:02 CEST 2006
Hi, all,
I just recently noticed a change in terms.formula from 2.2.1 to 2.3.1
(possibly 2.3.0, but I didn't check). Here's the problem:
## 2.2.1
> update(~ x | y, z ~ .)
z ~ x | y
## 2.3.1
> update(~ x | y, z ~ .)
z ~ (x | y)
and in the NEWS for 2.3.1
o terms.formula needed to add parentheses to formulae with
terms containing '|'. (PR#8462)
So, there must be a reason for this change. However, in the lattice
framework I have this causes many problems because now the `|' is
interpreted as a logical OR. Could someone suggest a workaround for me
so that I still get the 2.2.1 behavior my code relies on. Here's a very
simple test function (works in 2.2.1, fails in 2.3.1):
library(lattice)
foo <- function(x, data) {
x <- update(x, y ~ .)
xyplot(x, data)
}
z <- expand.grid(x = 1:10, g = letters[1:3])
z$y <- rnorm(nrow(z))
foo(~ x | g, z)
Thanks,
--sundar
More information about the R-help
mailing list