[R] The curious special case of ~ (a + b)/c

2010-06-05 Thread Nathaniel Smith
This isn't at all an urgent practical question, but recently while exploring the details of how R formulas are interpreted, I learned of this funny special case for how / interacts with +. In all of the following cases, the multiplication-like operator simply distributes over addition: (a + b):c

Re: [R] The curious special case of ~ (a + b)/c

2010-06-05 Thread RICHARD M. HEIBERGER
The / is used for nesting and is defined by A/B == A + (B %in% A) thus (a+b)/c == (a+b) + c %in% (a+b) == a + b + a:b:c Rich [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] The curious special case of ~ (a + b)/c

2010-06-05 Thread Nathaniel Smith
On Sat, Jun 5, 2010 at 2:01 PM, RICHARD M. HEIBERGER r...@temple.edu wrote: The / is used for nesting and is defined by A/B == A + (B %in% A) thus (a+b)/c == (a+b) + c %in% (a+b) == a + b + a:b:c ...I guess I could then ask why %in% is defined that way, but actually this rephrasing somehow