[R] How to read data from this csv?

Peter Ehlers ehlers at ucalgary.ca
Sat Jun 19 08:02:14 CEST 2010

On 2010-06-18 23:22, YI LIU wrote:
> I am so frustrated about reading data from this sample csv file.
> My code is :
>> test=read.csv(file='test.csv',header=T)
> warning message:
> In read.table(file = file, header = header, sep = sep, quote = quote,  :
>    incomplete final line found by readTableHeader on 'test.csv'
>> test
> [1] ÐÏ.à..
> <0 rows>  (or 0-length row.names)
> What is  the problem here?

No need to get frustrated; your file is not what you
think it is.

Most likely at least one of the lines in test.csv is _not_
complete, i.e. it's missing some data, which is what R is
trying to tell you.

Try count.fields() on your file and see if all lines do
have the same number of fields.

   -Peter Ehlers

> Thanks

More information about the R-help mailing list