Displaying 1 result from an estimated 1 matches for "catchtext".
Did you mean:
patchtext
2008 Jun 03
0
reading a file incrementally
...le.info("Module_1.txt")$size))[[1]]
## open connection
chk <- file("Module_1.txt", "r")
#seek(chk, origin = "start", ends[1]) # moves through file
## initalize an array
hold <- array(rep(NA, length(starts)))
## write a function to read the connection
catchtext <- function(start, end, source) {
for(i in 1:length(starts))
{
hold[i] <- readChar(chk, nchar = ends[i] - starts[i])
}
}
#close(chk)
and my output is
> hold
[1] NA NA NA NA NA NA NA NA NA NA NA NA N...