[R] Readbin and file position

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Feb 13 08:42:04 CET 2004


Jonathan Greenberg wrote:

> I have a binary file which is an image with multiple bands, arranged in BSQ
> format such that R, B and G are all N x M sized matrices (corresponding to
> Red, Blue and Green colors respectively).  The BSQ file arranges the data as
> [R, B, G], so to access the B matrix, I have to read forward N x M + 1
> number of samples.  Is there a fast way to define a variable as the B matrix
> exclusively (e.g. Can I use readbin to "fast forward" N x M + 1 samples to
> the beginning of the B matrix, and then read/define the B matrix
> exclusively, or do I have to read the entire file into memory, then subset
> out the B matrix?)
> 
> Thanks!
> 
> --j
> 


?readBin points us to ?connections which finally points us to ?seek 
which is the function you are looking for.

Uwe ligges




More information about the R-help mailing list