[R] Windows / Accented characters / pb with makename

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Aug 29 08:27:55 CEST 2000


On Mon, 28 Aug 2000, Charles RAUX wrote:

> Thank you for the hint (I didn't know makename). In fact contrary to 
> what is indicated in help makename doesn't give legal R names 
> (at least under Windows).
> See below:
> 
> > make.names("aéaéaéaùàééé")
> [1] "aéaéaéaùàééé"
> 
> 2) What is a "legal R name"? (found nowhere in FAQ, help...)

That's the problem. In S it is a-zA-Z0-9 plus `.'.  In R it would appear to
be those characters which are regarded as alphanumeric in the locale in use
plus `.' (Via a call to isalnum in both make.names and the parser.) Now
it's hard for me to test this, but I think in a French locale those chars
should be legal in names.  They are not in the C or en_UK locales, and
make.names on Windows does work in those locales.

There is something rather peculiar about locale support on Windows,
and for 1.2.0 R will have ways to override this.  Can someone who
has a non-C Unix locale let me know if there the non-English letters
are valid in names?   (What my experiments would suggest is that
Windows messed up the locale setting, and that may still be the case.)

I had two suggestions to offer:

a) You can use non-legal names by quoting them. So

summary(pollut$"Mortalite")  (my mailer loses the accented char)

should work.

b) Use chartr to translate the accented chars to their non-accented
equivalents.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list