8

Try it:

"hello" > 0

I tried using as.numeric("hello") but it just gave me back NA. What gives?

4

1 回答 1

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.
于 2013-06-10T18:13:02.497 回答