John Logsdon <j.logsdon at lancaster.ac.uk> writes:
> Hi
>
> In R 0.90.1 is there a way of stopping scan() from rewinding to the
> beginning of the file? Basically I have a mega-file (250Mb!!!) that I
> want to read and process in 301 line chunks, each line having 151 numbers
> on it.
>
> If I do
> for (i in 1:many){
> pp<-scan('filename',skip=(i-1)*301,nlines=301)
> }
>
> it appears to do what I want but as the chunks get further down the file
> it gets slower and slower.
>
> So can I stop the rewind?
I don't think you can - until someone implements "connections"
(wazzattherightname?) in R. If you're on some kind of Unix, you may
get away with hacking up something with named pipes.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._