When passing only one vector to a logical and / or operator, the operator negates the argument:
> x = c(F,T,T) > `&`(x) [1] TRUE FALSE FALSE > `|`(x) [1] TRUE FALSE FALSE
To make the logical operator work as idempotent, you need to pass one element vector as the second argument:
> `&`(x,T) [1] FALSE TRUE TRUE > `|`(x,F) [1] FALSE TRUE TRUE
Why do logical operators deny their argument when only one argument is passed?
source share