"1" is character value and other 1 is numeric. Even, when I tried executing below line it gave me TRUE.
as.character("0")==as.numeric(0)
Can anyone help me to understand, why?
"1" is character value and other 1 is numeric. Even, when I tried executing below line it gave me TRUE.
as.character("0")==as.numeric(0)
Can anyone help me to understand, why?
From the help("==")
:
If the two arguments are atomic vectors of different types, one is coerced to the type of the other, the (decreasing) order of precedence being character, complex, numeric, integer, logical and raw.
So 1
should be converted to "1"
.