[R] Any way to add to data frame saved as .rData file?

Duncan Murdoch murdoch at stats.uwo.ca
Tue Oct 11 22:38:31 CEST 2005


Ken Termiso wrote:
> Hi all,
> 
> I've got a script that generates a few moderate-size data frames, and then 
> puts them together into one big data frame at the end in order to write that 
> data frame to disk, so that it may be re-opened later on...
> 
> I'm trying to trim down memory requirements in this script, so I was 
> wondering if there was any way to append to a data frame already saved on 
> disk (just like appending to a text file)..all the data frames here have 
> identical row names; what I want to do is to tack on additional columns to a 
> data frame stored in the working directory...

No, I don't think so.
> 
> Alternatively, is there another data structure that would allow me to do 
> this (and could preferably be converted to a data frame) ?

I'd put the extra columns in their own data frame, and save that to disk 
(use dates/times/process ids or some other unique identifier in the 
filenames to distinguish them).  When you need access to a mixture of 
columns, load (or source, depending how you did the save) the columns 
you need, and cbind them together into one big data frame.

If you are concerned about memory requirements when producing the 
pieces, watch out that you don't write out so much data that you'll 
never have enough memory to load all you need at once.

Duncan Murdoch




More information about the R-help mailing list