Re: [R] Question about Sort

From: Wen Huang <whuang.ustc_at_gmail.com>
Date: Tue, 11 Nov 2008 10:51:58 -0600

Thanks a lot Professor Ripley!

I did not go into much of the details in the help page and was hoping somebody could have a quick answer.

The answer you provided is indeed helpful!

Thank you.

On Nov 11, 2008, at 10:40 AM, Prof Brian Ripley wrote:

> On Tue, 11 Nov 2008, Wen Huang wrote:
>
>> Hi,
>>
>> I am wondering if there is an option to control how R sort
>> characters on different machines.
>
> Yes, and it is described on the help page for sort:
>
> The sort order for character vectors will depend on the collating
> sequence of the locale in use: see 'Comparison'. The sort order
> for factors is the order of their levels (which is particularly
> appropriate for ordered factors).
>
> and do study the cross-reference and its references.
>
> Sorting on Mac OS X in UTF-8 locales seems broken (that is, the
> standard C functions compare in Unicode point order irrespective of
> language): we are working on a solution (the use of ICU. which can
> be compiled into R >= 2.8.0).
>
>>
>> For example, on my Mac OS X
>>
>>> sort(c("H", "a"), decreasing = TRUE)
>> [1] "a" "H"
>>
>> The same command on a Linux machine gives me
>>> sort(c("H", "a"), decreasing = TRUE)
>> [1] "H" "a"
>>
>> I don't know if there is an option to control the behavior of 'sort'.
>
> Well, the posting guide did ask you to do your homework, including
> reading the help pages.
>
>> Thanks,
>> Wen
>
>
> --
> Brian D. Ripley, ripley_at_stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595



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. Received on Tue 11 Nov 2008 - 17:00:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Nov 2008 - 17:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive