Skip to content
Prev 207461 / 398506 Next

R Memory Problem

prem_R <mtechprem at gmail.com> writes:
I'm analyzing a 8 GB data set using R, so it can certainly handle large
data sets.  It tends to copy data very often, however, so you have to be
very careful with it.

For example, if you modify a single column in a data frame, R will copy
the entire data frame, rather than just replace the modified column.  If
you are running a regression that saves the input data in the model
result object, and you are modifying the data frame between runs, then
it would be very easy to have many copies of your data in memory at
once.

One solution would be not to keep the model result objects around.
Another would be to manually modify them to strip out the data object.
This can be tricky, however, since copies of the data may live on in the
environments of saved functions; I had this problem with 'mgcv::gam'
fits.

I hope that helps.

Regards,
Johann
Message-ID: <u1od40yckmm.fsf@lx-chrateresearch01.citadelgroup.com>
In-Reply-To: <1264416244083-1289221.post@n4.nabble.com> (prem R.'s message of "Mon, 25 Jan 2010 02:44:04 -0800 (PST)")