[R] Readbin and file position

Wiener, Matthew matthew_wiener at merck.com
Fri Feb 13 14:57:55 CET 2004

The "seek" command will allow you to skip to a particular byte position in
the file.  You can define the position you want relative to your current
position, or to the start of the file.

Hope this helps,

Matt Wiener

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jonathan Greenberg
Sent: Thursday, February 12, 2004 9:51 PM
To: R-help
Subject: [R] Readbin and file position

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?)



Jonathan Greenberg
Graduate Group in Ecology, U.C. Davis
AIM: jgrn307 or jgrn3007
MSN: jgrn307 at msn.com or jgrn3007 at msn.com

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

Notice:  This e-mail message, together with any attachments,...{{dropped}}

More information about the R-help mailing list