I think it it makes sense.
TRUE and FALSE are 1 and 0, while `as.logical` will transform your value to the "closest" of those two.
If you are used to Pythons truthiness, that is what `as.logical` is similar to.
TRUE and FALSE are 1 and 0, while `as.logical` will transform your value to the "closest" of those two.
If you are used to Pythons truthiness, that is what `as.logical` is similar to.
>>> True + True
2
>>> True * 13 + (1 - False) * 17
30(The same happens in R, for what it's worth. as.integer(TRUE) is one and as.integer(FALSE) is zero and the operations you wrote work just he same.)
But it is an issue, and high level languages shouldn't just replicate it. In a high-level language `1 == TRUE` should be either an error or false.