[R] substitute accents

Manuel Gutierrez manuel_gutierrez_lopez at yahoo.es
Thu Nov 25 12:17:25 CET 2004


I have an openoffice spreadsheet with a column of
character strings.
Some of them contain accents.
I want to read it in R so I have saved it as a csv
file using Western Europe (ISO-8859-1) character set
(the default, I've tried other sets but it doesn't
help).
R reads it fine with 

CharMatrix<-read.csv("test.csv",header=F,sep=",",as.is=TRUE);
Say I wan't to replace the 'o' with accent in the
first cell.
I've tried:
gsub('ó','o', CharMatrix[1,1])
But, It doesn't make any substitution

Trying to find a solution I input the character string
in R and do the substitution:
CharMatrix[1,1]<-"hóla"
gsub('ó','o', CharMatrix[1,1])
And it works. I think the difference is that when I
now print the content of CharMatrix I get a \201
before the ó while I didn't get it with the openoffice
imported csv file.
I'm sure it is a problem with my understanding of how
accents can be specified. Can someone give me any
solutions / references?
Thanks,
M

         _                
platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    2                
minor    0.0              
year     2004             
month    10               
day      04               
language R   
		
______________________________________________



More information about the R-help mailing list