[R] Sorting strings

De-Jian Zhao dejian.zhao at gmail.com
Mon Feb 20 17:43:13 CET 2012


On 2012-2-20 23:15, Rui Barradas wrote:
> Could it be OS related?

Yes, it seems. I tried it on my local windows xp and redhat linux 
server, and got different results. Hope it will be fixed in the future 
versions. Maybe we should keep alert to check whether the results are 
consistent when transferring our code from one platform to another.


 > sort(c("X.","X0B"))
[1] "X."  "X0B"
 > sort(c("X.Z","X0B.Z"))
[1] "X0B.Z" "X.Z"
 > R.version
                _
platform       x86_64-unknown-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          2
minor          9.1
year           2009
month          06
day            26
svn rev        48839
language       R
version.string R version 2.9.1 (2009-06-26)



 > sort(c("X.","X0B"))
[1] "X."  "X0B"
 > sort(c("X.Z","X0B.Z"))
[1] "X.Z"   "X0B.Z"
 > R.version
                _
platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
status
major          2
minor          13.0
year           2011
month          04
day            13
svn rev        55427
language       R
version.string R version 2.13.0 (2011-04-13)



More information about the R-help mailing list