[R] Windows / RODBC / Accented characters
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Mon Aug 28 12:48:29 CEST 2000
"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."
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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