2013-06-10 16 views
8

はそれを試してみてください。"hello"> 0がTRUEを返すのはなぜですか?

"hello" > 0 

私はas.numeric("hello")を使用してみましたが、それは単にバックNAくれました。何がありますか?

+1

これは、すべてのロケールで「TRUE」を返すことはできません。これは照合順に文字「0」がどこにあるかによって異なります。 –

+1

文字の順序は「字句的に」です。これは、回帰関数と軸プロットラベルのコントラストがデフォルトでどのように処理されるかにも影響します。 –

+2

ちょうど好奇心の外に、あなたは何を期待しましたか?おそらく –

答えて

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. 
関連する問題