[R] Out of memory issue

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Apr 28 14:50:34 CEST 2009



Neotropical bat risk assessments wrote:
>    Hi again all,
>    I can read all of the data is in CSV format with a header row and with
>    1,200,240 rows.
>    I can do all the plots and ggplot2 has no problems.
>    Seems to be a problem with the MASS package???
>    It seems that the contour plots are the problem with the memory error.
>    Error: cannot allocate vector of size 228.9 Mb
>    I can run smaller data sets and do the contour plots w/o problems.
>    The data can not really be summarized as I need to plot the actual values to
>    get the insight into the large data sets.
>    I am using latest R version 2.9.0 (2009-04-17)
>    My alternative is to bump up the memory of my one Dell workstation to 16 GB
>    as it runs with Ubuntu and can access that amount if I figure out how to
>    install R on a Linux box.
>    It may not truly be a memory issue but a limit to how MASS does the contour
>    plots?
>    This works 100% with the large data sets.
>    Bodega <- read.csv ("C:/R-Stats/Bat calls/Bodega.csv")
>    attach(Bodega)
>    library(ggplot2)
>    f=jpeg(file="Bodega Sc_Fc plot.jpg")
>    print(qplot(Sc, Fc))
>    dev.off()
>    f=jpeg(file="Bodega Fc Dens plot.jpg")
>        print(qplot(Fc,geom="density"))
>    dev.off()
>    This does not.and I get the vector size error.
>    library(MASS)
>    library(batcalls)
>    BRC<-kde2d(Sc,Fc)
>    f=jpeg(file="Rainey contour plot.jpg")
>    filled.contour(BRC)
>             dev.off()
>    Thanks again for in sight as I trundle up the learn curve for R.

You need to think about how many points you are plotting into a filled 
contour plot (i.e. estimate what the memory is comsumed for just holding 
the image in memory) and how much memory has been wasted already. You 
may want to reduce the size of the stuff you are going to plot.

Uwev Ligges





>    Bruce
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list