"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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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) > pollutMortalit? 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? --------------- Charles RAUX, Laboratoire d'Economie des Transports CNRS-Universit? Lumi?re Lyon 2-ENTPE email : charles.raux at let.ish-lyon.cnrs.fr http://www.ish-lyon.cnrs.fr/let -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
The simplest suggestion I can give is to use an sql statement in which you make use of "as newfieldname". This will will change the names of the table columns and you should be ok. Regards YG ----- Original Message ----- From: "Charles RAUX" <Charles.Raux at let.ish-lyon.cnrs.fr> To: "r-help" <r-help at stat.math.ethz.ch> Sent: Monday, August 28, 2000 7:16 AM Subject: [R] Windows / RODBC / Accented characters> 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? > > --------------- > Charles RAUX, > Laboratoire d'Economie des Transports > CNRS-Universit? Lumi?re Lyon 2-ENTPE > email : charles.raux at let.ish-lyon.cnrs.fr > http://www.ish-lyon.cnrs.fr/let > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-> r-help mailing list -- Readhttp://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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. _._ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._