[R] problem with read.table -- example

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Fri Jan 25 11:56:06 CET 2002


Ott Toomet <siim at obs.ee> writes:

> Hi,
> 
> I have not get much response for my question about read.table for couple of
> days ago.  As I said, the problem is that read.delim() do not want to read
> more than 51 lines of data, with longer file it reads the first column as
> row names, although I have not noticed any special binary symbols around
> line 51 either.  This problem seems to happen with this particular file, I
> could easily read in a 12000 rows x 22 cols table.
> 
> I add my problematic file (it is really small) here, in a uuencoded gziped
> form.  What I did was:
> 
> > a <- read.delim("tab20.and")
> Error in "row.names<-.data.frame"(*tmp*, value = row.names) :
> 	duplicate row.names are not allowed
> 
> I am interested if anybody (specially on RH 7.1) is able to read the table
> in the same way.

The error message is unduly cryptic, but the problem seems to be this:

> count.fields("tab20.and",sep="\t")
 [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
[39] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 2 2 2 2 2 2 2 2 2
                                 ! !

(lines 53 and 54 have an extra TAB at the end)

Interestingly,

> read.table("tab20.and",head=T,sep="\t")
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
        line 1 did not have 3 elements

which is not exactly pinpointing the problem, but gives a better clue.
(I.e., fill=T is making things confused)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list