Message-ID: <32653E0E-4BB6-4701-B779-301E76D84306@comcast.net>
Date: 2009-10-24T03:17:58Z
From: David Winsemius
Subject: Encoding issue with read.csv
In-Reply-To: <7e5df3fe0910231234o477069c6re4f4ff4720a57958@mail.gmail.com>
On Oct 23, 2009, at 3:34 PM, Arcadio Rubio Garc?a wrote:
> Hi all,
>
> I've been given a CSV file saved on an old Windows 2000 machine. I
> think it's coded in Windows-1252 (roughly equivalent to ISO-8859-1 I
> think).
>
> When I try to open it with read.csv('foo.csv', encoding =
> 'iso-8859-1') I get a coding error.
It's consider good form to reproduce the entire error message.
>
> However, if I do:
>
> options(encoding = 'iso-8859-1')
> data <- read.csv('foo.csv')
>
> The file is opened smoothly. What am I doing wrong? Shouldn't the
> first work if the second does?
I cannot quite understand why you are annoyed/upset/bothered because
the file opened smoothly. My reading of the code in read.table, and
scan suggests that neither accesses the encoding settings that are
stored in options. These observations suggest to me that your beliefs
regarding encoding of the file in question may be false or you are
spelling ISO incorrrectly. I would have expected it to be
capitalized. Searching the archives suggests that you may want to try
encoding = "CP1252" for Windows csv files.
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT