r - TRUE and FALSE as boolean versus same as characters -
this question has answer here:
- why true == “true” true in r? 3 answers
could elaborate on, going on here:
a = "true" b = true #[1] "true" b #[1] true str(a) #chr "true" str(b) #logi true == b #[1] true
this true
string "true"
in e.g.:
"string" == true #[1] false
so not because non-empty string true
en e.g. perl, therefore have expected true == "true"
yield false
?
to quote ?comparison
in files:
if 2 arguments atomic vectors of different types, 1 coerced type of other, (decreasing) order of precedence being character, complex, numeric, integer, logical , raw.
r automatically coercing values down resulting in
"true" == true # [1] true 1 == true # [1] true
etc.
Comments
Post a Comment