Skip to content
Prev 258817 / 398502 Next

Read last line of a file

On Wed, May 04, 2011 at 02:17:29AM -0700, Joel wrote:
Hi.

The following reads the file into memory, but it is more
efficient than read.table(), since it does no parsing of
the file as a whole.

  x <- readLines("file")
  strsplit(x[length(x)], " +")[[1]][3]

Hope this helps.

Petr Savicky.