[R-sig-finance] Saving a matrix in binary format

Whit Armstrong whit at twinfieldscapital.com
Thu Apr 6 15:21:51 CEST 2006


Have a look at .saveRDS.  I use it extensively.


     .saveRDS(object, file = "", ascii = FALSE, version = NULL,
              compress = FALSE, refhook = NULL)
     .readRDS(file, refhook = NULL)



-----Original Message-----
From: r-sig-finance-bounces at stat.math.ethz.ch
[mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of Steven D.
Moffitt
Sent: Wednesday, April 05, 2006 4:01 PM
To: r-sig-finance at stat.math.ethz.ch; Indrajit Chatterjee
Subject: Re: [R-sig-finance] Saving a matrix in binary format

Dear Mr. Chatterjee,

I'm not aware of a function that does this generically, and I doubt
there exists one in the standard relase of R for the following reason -
different processors have different numerical formats that would require
a specialized format for general purpose floating-point storage.  For
example, Intel processors have a little endian architecture whereas
Sparcs have a big endian architecture.  Different processors represent
doubles differently, so that a read of a bits forming a double from one
processor won't be correct for another.  at the present time, processors
are transitioning from 32-bit to 64-bit, making it necessary to
distinguish 64-bit doubles from 80-bit doubles from 128-bit 'long
doubles.'  

In short, while it is possible to write a C/C++ program that would
accomplish what you want, it wouldn't be portable.  Even an upgrade from
an Intel x86 processor to an Itanium processor could give problems!

Steve Moffitt

Director of Research
WH Trading, LLC



---------- Original Message ----------------------------------
From: "Indrajit Chatterjee" <IChatterjee at axarosenberg.com>
Date:  Wed, 5 Apr 2006 11:16:19 -0700

>Hi - is it possible to save and load a matrix in binary form using R?
>
> 
>
>For example save.matrix() - and load.matrix() , but where the saves and

>loads are in binary format for speed and compactness.
>
>
>	[[alternative HTML version deleted]]
>
>_______________________________________________
>R-sig-finance at stat.math.ethz.ch mailing list 
>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>

_______________________________________________
R-sig-finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance



More information about the R-sig-finance mailing list