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

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Sun Aug 18 19:58:26 CEST 2002


This will not work if the table has no header.  scan() requires you to
specify the fields, but read.table does not and so you cannot know
which fields might be surplus.  Similarly, the header line might have
surplus fields ....


On Sun, 18 Aug 2002, Henrik Bengtsson wrote:

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

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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