[Rd] Bug in read.table (PR#463)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
01 Mar 2000 00:26:58 +0100


Thomas Lumley <thomas@biostat.washington.edu> writes:

> On Tue, 29 Feb 2000 venkat@biosta.mskcc.org wrote:
> 
> > 
> > I want to report a bug in read.table.  The attached output demonstrates
> > the bug.  Unfortunately, the data file contains confidential information
> > and hence cannot be attached.  Is there any way to figure out the cause 
> > of the bug and fix it?  Thanks.
> 
> 
> Here's the output in readable form. The bug seems to be that
> count.fields() thinks the records are the same length but read.table
> doesn't.

....
> > options(width=72)
> > count.fields("Consult/krasdata",sep="\t")
>   [1] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
>  [23] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
>  [45] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
>  [67] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
>  [89] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
> > read.table("Consult/krasdata",sep="\t")
> 
> row.lens=
>   [1] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
>  [23] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
>  [45] 18 18 18 18 18 18 18 18 18 18 18 18 18  1  1 18 18 18 18 18 18 18
>  [67] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
>  [89] 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18
> Error in read.table("Consult/krasdata", sep = "\t") :
>         all rows must have the same length.

read.data and count.fields have different defaults for the quote=
argument (which is arguably a bug). Try read.table(...,quote="") if
the data contain quote marks (single or double).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._