Re: [R] readBin: read from defined offset TO defined offset?

2009-05-15 Thread Johannes Graumann
Thanks guys!

Duncan's hints regarding character (which I was naturally using ;0) and 
the double readBin solved my problem - I'm extracting an index from a 
REALLY big XML file to get fast direct access to subsections, so that I only 
have to parse them rather than the whole thing (only SAX-style passing would 
be possible, since there's no way the thing will fit into memory).

Thanks again, Joh

Johannes Graumann wrote:

 Hello,
 
 With the help of seek I can start readBin from any byte offset within
 my file that I deem appropriate.
 What I would like to do is to be able to define the endpoint of that read
 as well. Is there any solution to that already out there?
 
 Thanks for any hints, Joh

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] readBin: read from defined offset TO defined offset?

2009-05-11 Thread Johannes Graumann
Hello,

With the help of seek I can start readBin from any byte offset within my 
file that I deem appropriate.
What I would like to do is to be able to define the endpoint of that read as 
well. Is there any solution to that already out there?

Thanks for any hints, Joh

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] readBin: read from defined offset TO defined offset?

2009-05-11 Thread jim holtman
Can you be more specific on how you want to define the endpoint of that
read.  What is the criteria you want to use?  Can you read in a block and
then search of the pattern?

On Mon, May 11, 2009 at 7:05 AM, Johannes Graumann johannes_graum...@web.de
 wrote:

 Hello,

 With the help of seek I can start readBin from any byte offset within
 my
 file that I deem appropriate.
 What I would like to do is to be able to define the endpoint of that read
 as
 well. Is there any solution to that already out there?

 Thanks for any hints, Joh

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] readBin: read from defined offset TO defined offset?

2009-05-11 Thread Duncan Murdoch

On 11/05/2009 7:05 AM, Johannes Graumann wrote:

Hello,

With the help of seek I can start readBin from any byte offset within my 
file that I deem appropriate.
What I would like to do is to be able to define the endpoint of that read as 
well. Is there any solution to that already out there?


Sure:  just use the n parameter to readBin.  This will work for any 
type except character, but it doesn't make sense to read those in a 
given range: what do you do if the last one is not zero terminated?  If 
you want the end of block to count as a terminator, then read the block 
as raw, add a null to the end, and then re-read the raw vector.


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.