[R] a question of alphabetical order

[Ricardo Rodriguez] Your XEN ICT Team webmaster at xen.net
Tue Apr 15 16:38:12 CEST 2008


Hi all,

In Spanish vowels with accent like á, é, ... doesn't affect to the 
alphabetical order of vector of strings. I mean, a or á don't matter for 
establishing the alphabetical order.

Nevertheless, while working with R order, here is what I get.

Given a file transport.txt

medio#variable
avión#34
barco#33
bicicleta#3
ángulo#37
camión#54
coche#23
tren#67

 > toPlot <- 
read.csv("~/Desktop/Workplace/transport.txt",header=TRUE,sep="#")
 > toPlot[order(toPlot$medio),]
      medio variable
1     avión       34
2     barco       33
3 bicicleta        3
5    camión       54
6     coche       23
7      tren       67
4    ángulo       37
 >

I expect ángulo appears in the first place as n (in ángulo) goes before 
v (in avión) and á/a doesn't matter for alphabetical order.

But ángulo appears in the last position.

Here my environment:

 > sessionInfo()
R version 2.7.0 beta (2008-04-12 r45280)
i386-apple-darwin9.2.2

locale:
es_ES.UTF-8/es_ES.UTF-8/C/C/es_ES.UTF-8/es_ES.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    
 > version
               _                                      
platform       i386-apple-darwin9.2.2                 
arch           i386                                   
os             darwin9.2.2                            
system         i386, darwin9.2.2                      
status         beta                                   
major          2                                      
minor          7.0                                    
year           2008                                   
month          04                                     
day            12                                     
svn rev        45280                                  
language       R                                      
version.string R version 2.7.0 beta (2008-04-12 r45280)
 >

Is it not possible to get this dataframe ordered correctly in Spanish? 
Other programs (Excel, for instance) do order correctly.

Thanks for your help,

Ricardo

-- 
Ricardo Rodríguez
Your XEN ICT Team



More information about the R-help mailing list