[R-SIG-Mac] a question of alphabetical order [follow-up]
[Ricardo Rodriguez] Your XEN ICT Team
webmaster at xen.net
Wed Apr 16 23:57:39 CEST 2008
Hi,
This issue comes from a thread of the same title, "a question of
alphabetical order", initiated yesterday in r-help at r-project.org list.
As it affects now only Mac environment, I follow Brian Ripley's advice
and move it to this list.
It is now clear that ordering lists/variable values is a kind of
nightmare whatever platform we use. As I (and possible many others!)
need to get a right order, or an "as right as possible" order, for list
of strings using non-ASCII character, namely áéíóú, ÁÉÍÓÚ and ñ,Ñ, we
have been considering a number of options.
Hans-Joerg Bibiko proposed a customized function to do the trick. Brian
Ripley spoke about es_ES.ISO8859-15 doing almost the right thing for
these characters.
Here what I get working in a MacBook which environment I describe at the
bottom of the message:
http://mire.environmentalchange.net/~webmaster/images/toPlot.png
Here the code:
png(file="toPlot.png", pointsize = 14, width = 1000, height = 480, units
= "px", bg="#eaedd5")
Sys.setlocale(category = "LC_ALL", locale = "es_ES.ISO8859-15")
toPlot <- data.frame(medio=c("avión", "barco", "bicicleta", "ángulo",
"choco", "camión", "coche", "tren", "aleta", "luna", "llave"),
variable=c(34, 33, 3, 37, 54, 23, 67, 30, 23, 56, 13))
toPlot<-toPlot[order(toPlot$medio),]
Sys.setlocale(category = "LC_ALL", locale = "en_GB.UTF-8")
barplot(toPlot$variable,names.arg=toPlot$medio)
dev.off()
As you see in the order of labels, accent is not ignored, and ch and ll
are considered as single instances. These are not longer the case with
Spanish alphabetical order. It changed in 1994.
So, Hans's solution seems the only one available to the correct order.
At least working with in the environment described below.
In any case, please,
1. Are you aware of any new locale we could try to see if it is already
updated?
2. If it doesn't exist, how/where must we go to propose/start creating
such e locale?
Here the environment:
> 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)
> sessionInfo()
R version 2.7.0 beta (2008-04-12 r45280)
i386-apple-darwin9.2.2
locale:
en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
>
R GUI 1.24-devel (5072)
Thank you so much for your help,
Ricardo
--
Ricardo Rodríguez
Your XEN ICT Team
More information about the R-SIG-Mac
mailing list