Hi dear R users.

I got a file that I need to extract the third column (or word) of the last
line of files that has a diffrent amounts of rows.
It works with 

x<-read.tables("file")
x[1,3] 

This returns the proper result but as the files is large this takes time and
uses memory that is just unneccery.

p<-read.table(textConnection(system("tail -1 file",intern=TRUE)))
p[1,3]

This also returns the proper result but then requires the system to be unix
based witch is quite silly if you ask me. Would rather just use R commands.

So Im wondering if anyone of you got a better way of reading the last line
of a file and extracting the third column (or word) of that line.

Best regards
//Joel Damberg



--
View this message in context: 
http://r.789695.n4.nabble.com/Read-last-line-of-a-file-tp3494963p3494963.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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