[R] Problem with read.table in Windows and Linux
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Oct 3 18:22:27 CEST 2008
On Fri, 3 Oct 2008, Uwe Ligges wrote:
>
>
> Carlos Morales wrote:
>> Hello everyone,
>>
>> I'm trying to open the same file under Linux and Windows. Under Windows
>> everything is ok but when I try to do it under Linux I have a mistake and I
>> don't know why. This is the mistake:
>>
>> Error in make.names(col.names,unique=TRUE):
>> string multibyte 1 invalid
>
> Your system guesses a different encoding than the file is in fact, I guess...
And there are worked examples about how to tell R the correct encoding on
the file() help page (as referenced from the read.table() help page). If
this is a Windows Spanish text file, the required encoding is most likely
CP1252, so try
con <- file(<filename>, encoding="CP1252")
read.delim2(con, header=TRUE)
close(con)
>
> Uwe Ligges
>
>
>>
>> why?
>>
>> I write this when I want to do it under Windows:
>> zz.info<-read.table(file("C:/Documents and
>> Settings/Administrador/Desktop/carlos/aCGH/aCGH/examples/Anal_sin_norm_1Mb86_Segmentos3.txt","r+"),header=TRUE,sep="\t",dec=".")
>> and under Linux:
>> zz.info<-read.table(file("/home/carlos/Desktop/Anal_sin_norm_1Mb86_Segmentos3.txt","r+"),header=TRUE,sep="\t",dec=".")
>> Why do I have problems under Linux?. If you need the text file tell me it.
>> Thanks so much for your help
>> Carlos
>>
>>
>>
>>
>> ______________________________________________
>> R-help at 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.
>
> ______________________________________________
> R-help at 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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list