[R] Windows / Accented characters / pb with makename
Charles RAUX
Charles.Raux at let.ish-lyon.cnrs.fr
Mon Aug 28 15:41:54 CEST 2000
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...)
Le 28 Aug 00 à 12:48, Peter Dalgaard BSA écrivait:
> To: "Charles RAUX" <Charles.Raux at let.ish-lyon.cnrs.fr>
> Cc: r-help <r-help at stat.math.ethz.ch>
> Subject: Re: [R] Windows / RODBC / Accented characters
> From: Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk>
> Date: 28 Aug 2000 12:48:29 +0200
> "Charles RAUX" <Charles.Raux at let.ish-lyon.cnrs.fr> writes:
>
> > A disturbing behaviour of R: an import of data using RODBC library
> > (Windows 98, R 1.1.1) recognizes accented characters in variables
> > names but these can't be manipulated further. See below:
> > > library(Rodbc)
> > > ch<-odbcConnect("Paradox Files")
> > > pollut<-sqlFetch(ch,Pollutio)
> > > pollut
> > Mortalité Densité Pollution
> > 1 82 600 110
> > 2 97 960 140
> > 3 76 570 90
> > ......
> > > attach(pollut)
> > > summary(Pollution)
> > Min. 1st Qu. Median Mean 3rd Qu. Max.
> > 90 120 160 160 190 250
> > > summary(Mortalité)
> > Error: syntax error
> >
> > Is there another solution than changing the names of the fields under
> > Paradox. Or RODBC package should be enhanced to automatically change
> > the accented characters?
>
> The quick way out would be to say
>
> pollut <- sqlFetch(ch,Pollutio)
> names(pollut) <- c("Mortalitee", "Densitee", "Pollution")
> attach(pollut)
>
> Does make.names work on Windows? (I.e. does it agree with the parser
> about what is a valid name?) If it does, then a more general solution
> would be
>
> names(pollut) <- make.names(names(pollut))
>
> although it would make the names a bit uglier: "Mortalit.", "Densit."
> --
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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