Skip to content

compressing data without writing output to file

2 messages · Markus Loecher, Brian Ripley

#
What do you want the compressed R object to be?  (It is not an R 
object.)

Omegahat package Rcompression may help you, but it returns a raw 
vector (and that has overheads such as the header: you could use its 
length if appropriate).
On Sat, 7 Feb 2009, Markus Loecher wrote:

            
It is ore than a little imprecise ....
Hmm, that calcuates the size of a compressed character representation 
of the object.  So do you want the size of an object or of its 
character representation?  object.size() calculated the first.
The overheads of finding a character representation and of allocating 
an R object for the result would also be large.
I don't see the pooint of calculating the size of something you will 
not use.  And anything involving 'hundreds of thousands of objects' is 
better done in C code.  So why not just write a C function to do 
whatever it is you really want (but have not told us).

In fact ehe way lazy-loading is implemented is pretty close to what 
you describe -- that uses an on-disk database and it not slow for 
100,000 objects.
PLEASE do read the posting guide (belatedly) and do not send HTML as 
you were asked.