试一试:
"hello" > 0
我尝试使用as.numeric("hello")
,但它只是给了我NA
。是什么给了什么?
答案 0 :(得分:13)
因为0
被强制转移到"0"
。见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.