[R] Sorting strings

statquant2 statquant at gmail.com
Mon Feb 20 11:18:42 CET 2012

Hi all, I am having difficulties to understand how R sort strings:

If I do
R) sort(c("X.","X0B"))
[1] "X."  "X0B"

So for me, as far as lexicographic order is concerned I can add whatever to
the end, the order will remain the same, but :
R) sort(c("X.Z","X0B.Z"))
[1] "X0B.Z" "X.Z"

Can somebody give me a trick for the order to become lexicographic ?  

View this message in context: http://r.789695.n4.nabble.com/Sorting-strings-tp4403696p4403696.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list