[R] What "method" does sort() use?

Patrick Connolly p_connolly at slingshot.co.nz
Fri Mar 18 10:02:28 CET 2016

I don't follow why this happens:

> sort(c(LETTERS[1:5], letters[1:5]))
 [1] "a" "A" "b" "B" "c" "C" "d" "D" "e" "E"

The help for sort() says:

  method: character string specifying the algorithm used.  Not
          available for partial sorting.  Can be abbreviated.

But what are the methods available?  The help mentions xtfrm but that
doesn't illuminate, I'd have thought that at least by default it would
have something to do with ASCII codes.  But that's not the case since
all the uppercase ones would be before the lowercase ones.

I know something different is happening but I don't know what it is
(do you, Mr Jones?).  Apologies to Bob Dylan.

   ___    Patrick Connolly   
 {~._.~}                   Great minds discuss ideas    
 _( Y )_  	         Average minds discuss events 
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)  	                      ..... Eleanor Roosevelt

More information about the R-help mailing list