On Aug 26, 2010, at 10:35 AM, Niels Richard Hansen wrote:

> 
> 
> On 26/08/10 09.30, Dimitris Rizopoulos wrote:
>> I think you need an I(), i.e.,
>> 
>> form <- ~ I(a > 1) - 1
> 
> Yes, it solves the concrete problem, but does not really answer
> the question. Let me rephrase. Should the use of terms like (a>1)
> be discouraged in R and replaced by I(a>1) systematically, or is the
> behavior below unexpected?

I'd say "yes", and "maybe". I think the only constructs that are guaranteed to 
protect arithmetic expressions are function calls, including I(). So it is more 
or less coincidental that ~ (a>1) - 1 works in the first place; when updating 
it, you probably should "expect the unexpected".  

There could still be a bug -- it looks somewhat wrong that a>1 isn't retained 
as a call to "<" with arguments a and 1, parentheses or not, but the model 
formula expansion code involves deep and dark magic, and I'd just avoid going 
too near it.


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to