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

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
23 Apr 2002 19:03:07 +0200


richard_raubertas@merck.com writes:

> > From: 	Huntsinger, Reid  
> > Sent:	Monday, April 22, 2002 5:15 PM
> > To:	Raubertas, Richard
> > Subject:	RE: R problem
> > 
> > [ ... ] This happens 
> > because of the attempt to convert. The function type.convert 
> > is called on columns with unspecified types; this tries to 
> > convert to "logical, integer, numeric or complex" in that 
> > order (first one that is successful wins). You have some ids 
> > like 21428-2 which type.convert doesn't like as numeric but 
> > will treat as complex. This in turn is due to R's hand-rolled 
> > "strtoc" function, which returns 0+0i for something it 
> > doesn't like. This is a valid value, so the conversion 
> > "works", and all values are converted this way... 
> > 
> > You or I should probably alert the R people. That's not very 
> > good behavior.

Right, but not something we can fix for 1.5.0. Another version of the
same effect is

> scan(what=0+0i)
1: 21419-2
2: Read 1 items
[1] 0+0i

A workaround would be to use the colClasses argument, or as.is.

-- 
   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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._