I have a bunch of output .txt-files that consists of a large parameter list and a X-Y-coordinate set. I need to extract these coordinates from all files so that only those l
An possible approach could be the following:
conn<-file("file.txt",open="rt")
x<-TRUE
while (x)
{x<-!grepl("coordinatesXY",readLines(conn,n=1))}
ret<-read.table(conn,...) #insert additional parameters to read.table
close(conn)
You read one line at the time from the input file and stop when you find the indicator string. Then you read the file through read.table. With this approach you don't store the entire file in memory, but just the piece you need.