Scanning data files line-by-line
On Wed, 30 Apr 2003 12:45:33 +0000, RAF wrote:
Maybe I'm missing something. When I do readLines( "file", n = 1) and repeat, it always reads the first line of "file". I've to be able to advance to the next line, no? I'll take a look at the command file(), as someone else suggested.
Yes, that's your solution.
con <- file("foo")
will open the file called foo and attach it to a connection called
con. You pass con to readLines, and since the file stays open between
calls, you'll get successive lines. Remember close(con) when you're
done.
Duncan Murdoch