boolean logic - Why TRUE == "TRUE" is TRUE in R? -
why true == "true"
true
in r? is there equivalent ===
in r?
update:
these returning false
:
true == "true" true == "true" true == "t"
the true
value true == "true"
.
in case of checking identical()
works fine.
second update:
by ===
operator meant process of checking value , data type of variable. in case assumed ==
operator compare values of variables, not data type well.
according help file ?`==`
:
if 2 arguments atomic vectors of different types, 1 coerced type of other, (decreasing) order of precedence beingness character, complex, numeric, integer, logical , raw.
so true
coerced "true"
(i. e. as.character(true)
), hence equality.
the equivalent of operator ===
(i. e. 2 objects equal , of same type) function identical
:
identical(true, "true") [1] false
r boolean-logic
No comments:
Post a Comment