[R] sorting character vectors

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Aug 19 15:21:06 CEST 2004


andreas.krause at pharma.novartis.com writes:

> Thank you very much to Brian Ripley, Roger Peng, and Andy Liaw. Everyone 
> pointed out the same solution.
> Setting
> LC_COLLATE=C
> did it. This default setting is indeed odd to me.

It's odd to everyone, except perhaps to the POSIX locale mafia... Once
upon a time all dotfile sorted to the top of but nowadays "LANG=da_DK
ls -a | less" gives you

...
a2ps
a2ps-4.13-3.i386.rpm
abcd.txt
.AbiSuite
.ab_library
abline.ps
.acrobat
.acrorc
.acrosrch
active.rtf
...

Oddly enough da_DK does sort names with a leading space before
characters, whereas de_DE does not.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list