[R] Problem reading non-ISO data via read.csv2

Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si
Tue Oct 24 17:50:37 CEST 2006


Prof Brian Ripley wrote:
...
>> There are some "strange" characters in it, but I never experienced such
>> behaviour. Actually, this file was produced with R (2.4.0) on Windows!
> 
> Well, then it cannot be a UTF-8 file (there are no UTF-8 locales on
> Windows, not any means to write a UTF-8 file here), and you have told R
> to read it in your UTF-8 locale.
> 
> You need to specify the correct encoding: see ?file. But then you would
> have to do that in any application with such a text file, as an
> application could at best guess the encoding.

Thank you very much. Your suggestion solved my problem i.e. I have used:

read.csv2(file=file("pasme2.csv", encoding="WINDOWS-1252"))

>> Utility file under Linux says:
>>
>> $ file pasme2.csv
>> pasme.csv: Non-ISO extended-ASCII text
>>
>> I am attaching few lines of a file for example. And mandatory info:
> 
> No attached file appeared.

That is weird as my sent folder shows mail with an attachment. Anyway,
problem is solved now - with Your help!

-- 
Lep pozdrav / With regards,
    Gregor Gorjanc
----------------------------------------------------------------------
University of Ljubljana     PhD student
Biotechnical Faculty
Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si

SI-1230 Domzale             tel: +386 (0)1 72 17 861
Slovenia, Europe            fax: +386 (0)1 72 17 888

----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try." Sophocles ~ 450 B.C.



More information about the R-help mailing list