[R] Problem with accented characters in portuguese

Luis Torgo ltorgo at liacc.up.pt
Tue Nov 26 18:13:44 CET 2002


Dear all,
I've recently encountered a strange behaviour when using R with portuguese 
accented characters. The most curious aspect is that using the same code with 
ESS under XEmacs the behaviour is different.
My system is:

> R.version
         _              
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    1              
minor    6.1            
year     2002           
month    11             
day      01             
language R

Here it goes a trace of the "problem":

First under Rgui

> salário <- 45    # this is ok!
> salário
[1] 45
> objects()
[1] "salário"
> d <- data.frame(salário=c(34,45),name=c('xyz','fgd')) # this is NOT ok!
> d
  sal.rio name
1      34  xyz
2      45  fgd

> d$salário
NULL
> d$sal.rio
[1] 34 45


Now with ESS 5.1.20 under XEmacs 21.4

> salário <- 45
> salário
[1] 45
> d <- data.frame(salário=c(34,45),name=c('xyz','fgd'))
> 
> d
  salário name
1      34  xyz
2      45  fgd
> d$salário
[1] 34 45


Another "funny" thing about this is that is does not happens with all accented 
characters of Portuguese. Check this trial whether I've used a column with a 
name using almost all accented characters of Portuguese:

In Rgui

> d2 <- data.frame(áçãóíéúàìòùêîõ=c(34,45),name=c('xyz','fgd'))
> d2
  X.çãóíéúàìòù.îõ name
1              34  xyz
2              45  fgd

As you can see the problem occurs with á and ê, and not with the other 
accented characters.

In Ess:

> d2 <- data.frame(áçãóíéúàìòùêîõ=c(34,45),name=c('xyz','fgd'))
> d2
  áçãóíéúàìòùêîõ name
1             34  xyz
2             45  fgd


Thank you for any help.

-- 
Luis Torgo
    FEP/LIACC, University of Porto   Phone : (+351) 22 607 88 30
    Machine Learning Group           Fax   : (+351) 22 600 36 54
    R. Campo Alegre, 823             email : ltorgo at liacc.up.pt
    4150 PORTO   -  PORTUGAL         WWW   : http://www.liacc.up.pt/~ltorgo

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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