[R] Unexpected behaviour of read.table

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon May 31 00:28:02 CEST 1999


David Clayton <david.clayton at mrc-bsu.cam.ac.uk> writes:

> 1,,3
>  ,5,6
> ,8,9 
..
> Splus handles this OK and returns
> 
>   V1 V2 V3 
> 1  1 NA  3
> 2 NA  5  6
> 3 NA  8  9
> 
> as expected.

Hum. With my suggested change PLUS interchanging the 2 'if's, I now
get:

> read.table('junk',sep=',')
  V1 V2 V3
1  1 NA  3
2     5  6
3 NA  8  9

which on closer thought actually *is* what I'd expect - if you have a
space in a comma-separated field, the column should be of type
character/factor, no?

BTW: "r-testers"?? That address got superseded by the r-help/r-devel
lists something like two years ago.... Arguably, this discussion
should have gone to r-devel, not r-help or even better to r-bugs, so
it would get an official Problem Report number. (I'm leaving it in
r-help for now, since that where the previous messages went, but if we
need to discuss it more extensively, we should probably move it to
r-devel)

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