I learnt from this forum to test for EOF reached with fiunction readLines as 
follows:

 con <- file("MyFle.txt","r")
  repeat {
   line <-  readLines(con,n=1)
   if (length(line) == 0) break
  }

It works fine if I read one line at a time.
Since now I have a huge file so that it would take forever to read one line at 
a time,
I wonder how to test for EOF whenreading blocks of,say, 100 lines at a time.
Will the following work ?

 con <- file("MyFle.txt","r")
  repeat {
   line <-  readLines(con,n=100)
   if (length(line) < 100) break
  }

Thank you very much.
Maura


tutti i telefonini TIM!


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to