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 = a:c + a:c
  a:(b + c) = a:b + a:c
  (a + b)*c = a*c + b*c
  a*(b + c) = a*b + a*c
  a/(b + c) = a/b + a/c

But:
  (a + b)/c = a + b + a:b:c, not a/c + b/c = a + a:c + b + b:c

Chambers and Hastie mention this, but give no explanation (page 29/30,
"Slightly more subtle is...").

So for my own edification, does anyone know/care to speculate about
why (a + b)/c works this way?

-- Nathaniel

______________________________________________
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