boolean expression - Why do logical operators negate their argument when there is only one argument in R? -
when passing single vector logical and/or operator, operator negates argument:
> x = c(f,t,t) > `&`(x) [1] true false false > `|`(x) [1] true false false
to make logical operator work idempotent, 1 needs pass single element vector second argument:
> `&`(x,t) [1] false true true > `|`(x,f) [1] false true true
why logical operators negate argument when there 1 argument passed?
this was modified in r 3.2.1 result of a bug report. you've pointed out, previous behavior made little sense:
Comments
Post a Comment