Best Answer · By JanBask Data Science Expert
Answered on Nov 3, 2019
Reading all the lines at a time is possible but can be ricky so to process the line one at a time for reading, we can do the following
processFile = function(filepath) {
connection = file(filepath, "r")
while ( TRUE ) {
lines = readLines(connection, n = 1)
if ( length(lines) == 0 ) {
break
}
print(lines)
}
close(connection)
}