Re: [R] How can I test for End-Of-FIle

2009-07-12 Thread jim holtman
You can do something like this: con <- file("MyFle.txt","r") repeat { line <- readLines(con,n=1) if (length(line) == 0) break ParseLine(line) } On Sun, Jul 12, 2009 at 6:20 PM, wrote: > I have a long text file with uneven record length and variable structure. > Therefore I have to read

[R] How can I test for End-Of-FIle

2009-07-12 Thread mauede
I have a long text file with uneven record length and variable structure. Therefore I have to read it line-by-line. I found out I can open a connection to the file and read in one line at a time. Something like: con <- file("MyFle.txt","r") while (End-Of-File) { line <- readLines(con,n=1)