[Rd] Historical NA question

Hadley Wickham h.wickham at gmail.com
Tue May 6 18:20:07 CEST 2014


>> BTW, that %in% has precedence over arithmetic operations is surprising,
>> error-prone, and doesn't cover any reasonable use case (who needs to
>> multiply the logical vector returned by %in% by some value?) but that's
>> another story:
>
> The point here is that the %foo% operators all have the _same_ precedence. In principle, they can be user-coded, and there is no way to express what precedence is desirable. It may turn out slightly weird for %in%, but think of what would happen if %*% had lower precedence than addition.

This is getting way off topic, but I find the precedence of ! to be
more surprising:

> !F + !F
[1] FALSE

i.e. that's interpreted as !(F + !F) not (!F) + (!F).

Hadley

-- 
http://had.co.nz/



More information about the R-devel mailing list