Skip to content
Prev 48204 / 63424 Next

Historical NA question

On 05/04/2014 06:35 PM, Michael Friendly wrote:
Not sure that would make the "joke" better, but you need parentheses 
around the product because it seems %in% has precedence over * (the
fact that you got a number instead of a logical gives you a hint):

   > (2*(1-pnorm(1954))) %in% NA
   [1] FALSE

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:

   > 3 + 2 %in% 1:6
   [1] 4
   > 3 - 2 %in% 1:6
   [1] 2
   > 3 * 2 %in% 1:6
   [1] 3
   > 3 / 2 %in% 1:6
   [1] 3

Weird!

H.