I’m just learning R, and I tried this:
str("Hello") == str("World!")
I was expecting an logical output, like TRUE or FALSE, but instead, it returned this:
chr "Hello" chr "World!" logical(0)
I didn’t understand why, bacause the str() function should print the class and whatever is inside parenthesis…
Could someone help me in understanding this, please?
Many thanks.
Tried: str("Hello") == str("World!")
Expected: "TRUE" or "FALSE"
Reality:
chr "Hello" chr "World!" logical(0)
>Solution :
See the following.
tmp <- str("Hello")
print(tmp)
is returning:
chr "Hello"
NULL
So you see that NULL is assigned to tmp. The same is for str("whatever").
So you are calling :
NULL == NULL
That’s obviously logical(0)