On 1 May 2004 at 16:35, Vadim Ogranovich wrote:

> Unfortunately, seek only works in terms of bytes not lines and I only
> know how many lines I need to skip, but not bytes.
> 

read.table() has a skip= agrument

(probably also has scan()   )

Kjetil Halvorsen

> 
> -----Original Message-----
> From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, May 01, 2004 3:44 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [R] skip lines on a connection
> 
> 
> 
> 
> ?seek
> 
> Vadim Ogranovich <vograno <at> evafunds.com> writes:
> 
> : 
> : Hi,
> : 
> : I am looking for an efficient way of skipping big chunks of lines on
> a : connection (not necessarily at the beginning of the file). One way
> is to : use read lines, e.g. readLines(1e6), but a) this incurs the
> overhead of : construction of the return char vector and b) has a
> (fairly remote) : potential to blow up the memory. : : Another way
> would be to use scan(), e.g. : : scan(con, skip=1e6, nmax=0) : : but
> somehow this doesn't work: : : > scan(con, skip=10, nmax=0) : Error in
> scan(con, skip = 10, nmax = 0) : :  "scan" expected a real, got
> "A;12;0;" : : I can stick to readLines, but am curious if there is a
> better way. : : I use R-1.8.1 on RH-7.3. : : Thanks, : Vadim
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to