[R] readLines with space-delimiter?

Duncan Murdoch murdoch.duncan at gmail.com
Wed May 5 13:30:30 CEST 2010


Seth wrote:
> Thanks.  I wasn't aware that scan or read.table allowed you to read in a
> single line, process it, output results, and then read in the next line. 
> This is what I need to do because the data set is too large to hold in RAM. 
> I did manage to do this with readLines and overcome the space-delimiter
> issue.
>   

You can read a fixed number of lines, then process them; then you can 
repeat.  The key is to open the file as a connection before calling 
read.table, and don't close it after each read.  But you were probably 
doing that with readLines.

Duncan Murdoch



More information about the R-help mailing list