[R] writing lists fastly on file

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Nov 30 14:42:27 CET 2006


On Thu, 30 Nov 2006, Duncan Murdoch wrote:

> On 11/30/2006 6:55 AM, Milton Cezar Ribeiro wrote:
>> Hi there,
>>
>>   I have a big amount of "lists" of data, each one with dimension 
>> 1024x1024. When I save it in an ASCII file (using "write" function) it 
>> take about 15 minutes. As I need run about 500,000 times this same 
>> routine, and I would like to do this save task in a fast way.
>
>>   In fact I will use these output files in another program that read 
>> ASCII or RAW/Generic Binary (8bits) formats. Each value from my lists 
>> ranges from 1 to 200 (integer values).
>
> I think this depends on the details.  Can you show us what str() gives
> for one of these lists?  Can you tell us how flexible the other program
> is about the format of what it needs to see?  "RAW/Generic Binary"
> sounds like a format for an image from a digital camera; there might be
> packages available in R that are specifically designed to write that
> format but I don't know them.

Sounds like a job for writeBin(size=1).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list