[R] Reading text files from other languages

Julio Sergio juliosergio at gmail.com
Sun Mar 11 00:41:45 CET 2012

I'm trying to read a data file that contains characters from the Spanish 

> Station <- read.fwf("LosDatos.txt",widths=c(7,7,25,8,8,5),header=FALSE,
+                     skip=3,n=separ[1]-4)

Then the R interpreter issues the following message:

  Error en substring(x, first, last) : 
    invalid multibyte string at '<d1>A, S.'
  Calls: read.fwf -> cat -> sapply -> lapply -> FUN -> substring

I know that the message is because there is a "Ñ" before the text "A, S.".

Is there a way to tell R that the text file is UTF-8 encoded?



More information about the R-help mailing list