I just started learning R and in my first assignment, I face a problem where I need to compare a bunch of variables and while doing that I am supposed to get false when comparing two variables not only when they are not equal but also when their type is not same. For example :
7 == "7"
gives true which should be false. Currently, I am doing the same as follows:
var1 = 8 == "8"
var2 = typeof(8) == typeof("8")
var1 & var2
I guess there should be some much simpler approach for the same. It seems like it implicitly converting 7 to "7" as it does when we add numeric to a character vector. So is there a way to get the same result in 1 line?