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

______________________________________________
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.

Reply via email to