readf2cio {Nmix} | R Documentation |
Reading binary file of structured binary numerical data
Description
Reading binary file of structured binary numerical data, for use in reading into R numerical data written from Fortran
Usage
readf2cio(fn,imax=Inf,verbose=FALSE)
Arguments
fn |
character variable, path to file to be read. |
imax |
maximum number of list components to be read. |
verbose |
boolean, should the reading be reported? |
Details
The function is designed to expedite the transfer of possibly large quantities of numeric information, in binary form, written, typically incrementally, in a Fortran routine called from R, without using the arguments to the function.
Assumed format for binary files holding lists, matrices or vectors of numeric data:
writable from Fortran via f2cio interface, readable in R using readBin
file structure supported: binary file, with integer(4), real(4) or double(8) data
first record: list: 0 0
matrix or vector: nc mode (mode = 1, 2 or 3 for integer(4), real(4) or double(8))
succeeding records, one per component of list or row of matrix:
list: number of items, mode as integers, followed by data for this component
(note that modes can differ between but not within components)
matrix or vector: data for this row
one-column matrices are delivered as vectors
Value
numeric list, vector or matrix according to layout of information in fn
; see Details.
Author(s)
Peter J. Green
Examples
data(galx)
z<-Nmix('galx',nsweep=10000,nburnin=1000,out="d")
z