[R] Sorting strings

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


Sorry, just made a mistake. This is the result from windows xp.

 > 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)


On 2012-2-21 0:13, De-Jian Zhao wrote:
> It seems OS-dependent. I got different results when trying it on 
> windows xp and Redhat linux.
>
>
> > 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       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] "X0B.Z" "X.Z"
>
>
> On 2012-2-20 23:27, statquant2 wrote:
>> Ok I have :
>>
>> R) str(R.Version())
>> List of 13
>>   $ platform      : chr "x86_64-unknown-linux-gnu"
>>   $ arch          : chr "x86_64"
>>   $ os            : chr "linux-gnu"
>>   $ system        : chr "x86_64, linux-gnu"
>>   $ status        : chr ""
>>   $ major         : chr "2"
>>   $ minor         : chr "12.2"
>>   $ year          : chr "2011"
>>   $ month         : chr "02"
>>   $ day           : chr "25"
>>   $ svn rev       : chr "54585"
>>   $ language      : chr "R"
>>   $ version.string: chr "R version 2.12.2 (2011-02-25)"
>>
>> R) sort(c("X.","X0B"))
>> [1] "X."  "X0B"
>> R) sort(c("X.Z","X0B.Z"))
>> [1] "X0B.Z" "X.Z"
>>
>> I am using a linux redHat
>> $ uname -a
>> Linux 2.6.18-238.9.1.el5 #1 SMP Fri Mar 18 12:42:39 EDT 2011 x86_64 
>> x86_64
>> x86_64 GNU/Linux
>>
>>
>> -- 
>> View this message in context: 
>> http://r.789695.n4.nabble.com/Sorting-strings-tp4403696p4404298.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>



More information about the R-help mailing list