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,                  [EMAIL PROTECTED]
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@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.

Reply via email to