[R] how to read a file one line at a time?

Terry Westley twestley at buffalo.veridian.com
Fri Nov 12 17:34:05 CET 1999


Is there a way to read a file one line at a time?
My file is potentially very large (multiple gigabytes)
so I'd like to read and process one line at a time.

The only choices I see are:

1) Direct the file to standard input and use readline(),
   but then I have to parse the data columns myself.

2) Call scan() with nlines=1 over and over again, incrementing
   skip, but I suspect that it will read the whole file each
   time.

Any suggestions?

--
Terry J. Westley, Software Systems Engineering Supervisor
Veridian Engineering, Calspan Operations
P.O. Box 400, Buffalo, NY 14225
twestley at buffalo.veridian.com    http://www.veridian.com

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