我想在readLines
中通过R
读取txt文件的最后一行,我该如何实现?
con<-file("test.txt","r")
line<-readLines(con,n=-1)
cat(line,"\n")
close(con)
文本文件如下
3B1CHLH_PI210.PV 07-MAY-15 10:33:52.5 173.944 Good
3B1CHLH_PI210.PV 07-MAY-15 10:34:29.0 173.379 Good
3B1CHLH_PI210.PV 07-MAY-15 10:35:25.6 172.890 Good
3B1CHLH_PI210.PV 07-MAY-15 10:35:58.3 173.009 Good
3B1CHLH_PI210.PV 07-MAY-15 10:36:50.9 173.677 Good
3B1CHLH_PI210.PV 07-MAY-15 10:37:18.6 173.069 Good
3B1CHLH_PI210.PV 07-MAY-15 10:37:49.2 173.408 Good
3B1CHLH_PI210.PV 07-MAY-15 10:38:39.6 173.445 Good
3B1CHLH_PI210.PV 07-MAY-15 10:39:12.5 173.445 Good
我只能获取所有内容,但我只想阅读最后一行,R
中是否有任何方式,如fseek
中的C