Hi Julio, If you look at the documentation for
?read.fwf you will see '...' further arguments to be passed to 'read.table' and if you look at ?read.table you will see there is an argument called, 'encoding', so, yes. Just specify the encoding. Cheers, Josh On Sat, Mar 10, 2012 at 3:41 PM, Julio Sergio <julioser...@gmail.com> wrote: > I'm trying to read a data file that contains characters from the Spanish > language: > >> 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? > > Thanks, > > --Sergio. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.