Displaying 2 results from an estimated 2 matches for "myfle".
Did you mean:
myfile
2009 Jul 24
1
EOF revisited
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 l...
2009 Jul 12
1
How can I test for End-Of-FIle
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)
ParseLine(line)
}
But I realized I do not know how to test for the End-Of-File condition using R language.
I found a ghost documentation page mentioning an R built-in function "isEof(connection)".
But s...