Re: [R] read.table problem

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Wed 25 Jan 2006 - 19:56:23 EST

Andrej Kastrin <andrej.kastrin@siol.net> writes:

> Dear R useRs,
>
> I have big (23000 rows), vertical bar delimited file:
>
> e.g.
> A00001|Text a,Text b, Text c|345
> A00002|Text bla|456
> ...
> ..
> .
>
> Try using
>
> A <- read.table('filename.txt', header=FALSE,sep='\|')
>
> process stop at line 11975 with warning message:
> number of items read is not a multiple of the number of columns
>
> I have no problems with processing similar file, which is only 10000
> rows long?
>
> Any suggestion what's the problem here. Thank's in advance.

Well, the most obvious suspect is the file...

You might try

table(count.fields('filename.txt',sep='|'))

(There's no point in escaping the vertical bar)

Also, beware of quote symbols in the file, and possibly consider using fill=TRUE.

-- 
   O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Jan 25 20:04:42 2006

This archive was generated by hypermail 2.1.8 : Thu 26 Jan 2006 - 02:10:08 EST