[R] Adding argument 'flush' to read.table() too...

Henrik Bengtsson hb at maths.lth.se
Sun Aug 18 13:58:58 CEST 2002

What about adding the argument 'flush=FALSE' to read.table() for the option
to ignore trailing elements on each row? This feature already exists in
scan(), which is called internally by read.table():

   flush: logical: if `TRUE', `scan' will flush to the end of the line
          after reading the last of the fields requested. This allows
          putting comments after the last field, but precludes putting
          more that one record on a line.

Looking at the code for read.table(), adding argument 'flush=FALSE' and then
call scan(..., flush=flush) internally seems to be fully backward
compatible. However, I do not know about the S-Plus compatibility.

Comment: I found the need for this when trying to read TAB delimited data
files from an external software that (for unknown reasons) adds several
trailing TAB's to the last 5-10 rows.


Henrik Bengtsson

Dept. of Mathematical Statistics @ Centre for Mathematical Sciences
Lund Institute of Technology/Lund University, Sweden (+2h UTC)
+46 46 2229611 (off), +46 708 909208 (cell), +46 46 2224623 (fax)
h b @ m a t h s . l t h . s e, http://www.maths.lth.se/bioinformatics/

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