Re: [R] changes to terms.formula in 2.3.x

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Wed 21 Jun 2006 - 03:26:36 EST

Thanks, Gabor. Works like a charm.

--sundar

Gabor Grothendieck wrote:

> Try this:
> 

>> fo <- ~ x | y
>> fo[[3]] <- fo[[2]]
>> fo[[2]] <- as.name("z")
>> fo
> 
> z ~ x | y
> 
> On 6/20/06, Sundar Dorai-Raj <sundar.dorai-raj@pdf.com> wrote:
> 

>> 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
>>
>> ______________________________________________
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 21 03:44:07 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 21 Jun 2006 - 04:12:01 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.