[R] new read.table() error message in R 2.13.0 reading UTF-8 input

Levy, Roger rlevy at ucsd.edu
Tue Jun 28 00:22:09 CEST 2011


Hi,

Consistent with recent reports (http://tolstoy.newcastle.edu.au/R/e14/devel/11/06/0434.html) I have found what I believe is an error new to R 2.13.0 when reading a UTF-8 encoded file.  Minimal example:

=========== filename: test.txt =================

1 2 3 Я 4

================================================

[note that the fourth column is a Cyrillic character; file is saved in UTF-8.]

> read.table("/tmp/test")
  V1 V2 V3       V4 V5
1  1  2  3 \320\257  4
> read.table("/tmp/test",fileEncoding="UTF-8")
  V1 V2 V3
1  1  2  3
Warning messages:
1: In read.table("/tmp/test", fileEncoding = "UTF-8") :
  invalid input found on input connection '/tmp/test'
2: In read.table("/tmp/test", fileEncoding = "UTF-8") :
  incomplete final line found by readTableHeader on '/tmp/test'

I'm using OS X 10.6.7 with the pre-packaged R binaries from CRAN.

Best

Roger

--

Roger Levy                      Email: rlevy at ucsd.edu
Assistant Professor             Phone: 858-534-7219
Department of Linguistics       Fax:   858-534-4789
UC San Diego                    Web:   http://idiom.ucsd.edu/~rlevy











More information about the R-help mailing list