[R] do.call("+", ...)

Thomas Lumley tlumley at u.washington.edu
Fri Nov 17 15:37:31 CET 2006

On Fri, 17 Nov 2006, Robin Hankin wrote:
> OK, I see.  But in algebra the  "+" symbol is special: it is reserved
> exclusively for associative and commutative operations [thus a+b+c is
> always well-defined]; perhaps the parser could fall in with this
> convention?

It's not so long ago that we had a proposal for "+" to implement a 
non-associative and non-commutative operation: "+.character" was going to 
be string concatenation.

And as Peter pointed out, + is already non-associative under recycling 
rules.  Type changes are also a problem:
   > as.integer(2^30)+as.integer(2^30)+1
  [1] NA
  Warning message:
  NAs produced by integer overflow in: as.integer(2^30) + as.integer(2^30)
  > as.integer(2^30)+(as.integer(2^30)+1)
  [1] 2147483649


More information about the R-help mailing list