[R] Memory error

Thomas Lumley tlumley at u.washington.edu
Thu Mar 8 16:30:05 CET 2007

On Thu, 8 Mar 2007, Andrew Perrin wrote:

> Greetings-
> Running R 2.4.0 under Debian Linux, I am getting a memory error trying to
> read a very large file:
>> library(foreign)
>> oldgrades.df <- read.spss('Individual grades with AI (Nov 7 2006).sav',to.data.frame=TRUE)
> Error: cannot allocate vector of size 10826 Kb

Your file on disk seems to be about 300Mb, and it might well be larger in 
R, so it's probably too big for 32-bit R.

However, you could try to.data.frame=FALSE in the read.spss() call. Based 
on memory profiling of the fairly similar read.dta() function I would 
guess that as.data.frame.list() might well be the culprit.


More information about the R-help mailing list