Displaying 1 result from an estimated 1 matches for "num_lin".
Did you mean:
num_in
2012 Jun 06
3
extracting values from txt file that follow user-supplied quote
...DISCREPANCY ="
One approach I took was the following:
library(R.utils)
txt_con<-file(description="D:/MCR_BeoPEST - Copy/MCR.out",open="r")
#The above will need to be altered if one desires to test code on the
attached txt file, which will run much quicker
system.time(num_lines<-countLines("D:/MCR_BeoPEST - Copy/MCR.out"))
#elapsed time on full 1Gb file took about 55 seconds on a 3.6Gh Xeon
num_lines
#14405247
system.time(
for(i in 1:num_lines){
txt_line<-readLines(txt_con,n=1)
if (length(grep(" PERCENT DISCREPANCY =",txt_line))) {...