Message-ID: <509C2E97.8010900@gmail.com>
Date: 2012-11-08T22:13:43Z
From: Lee Hachadoorian
Subject: Help Read File With Odd Characters
In-Reply-To: <509B6478.8000501@stats.ox.ac.uk>
On 11/08/2012 02:51 AM, Prof Brian Ripley wrote:
> On 08/11/2012 07:11, Lee Hachadoorian wrote:
>> I have a large (105MB) data file, tab-delimited with a header. There are
>> some odd characters at the beginning of the file that are preventing it
>> from being read by R.
>>
> That is a BOM make in UCS-2 encoding. Was this file created on Windows?
>
> It so try using iconv to convert it to UTF-8, or in R use
>
> read.delim(filename, fileEncoding = "UCS-2LE")
Perfect. I tried it both ways, and both iconv and the fileEncoding
parameter did the trick.
As far as I know the file (which was provided by a public agency) was
created in Windows.
Thanks,
--Lee
--
Lee Hachadoorian
Assistant Professor in Geography, Dartmouth College
http://freecity.commons.gc.cuny.edu