[R] readBin: read from defined offset TO defined offset?
    Duncan Murdoch 
    murdoch at stats.uwo.ca
       
    Mon May 11 15:07:04 CEST 2009
    
    
  
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
    
    
More information about the R-help
mailing list