[R] readAsciiGrid memory issues

Roger Bivand Roger.Bivand at nhh.no
Thu Dec 4 19:25:07 CET 2008

 <Alexander.Herr <at> csiro.au> writes:

> Hi List,
> I am unable to read in a 7.8Gb ascii grid using readAsciiGrid {maptools} - R
runs out of memory. I have 4Gb ram
> and 4Gb swap, so things are getting tight.

This function is written for small rasters only, and is not suited to data of 
this size.

> I am wondering if anyone has alternative options (preferably with example)
that enable to read in large
> grids, do some calculations and save a new grid?

Use rgdal, preferably using a tiled approach, leaving at least 75% of your 
memory free initially, because operations on the tile will result in copies. 
See several threads on R-sig-geo on handling large data sets, including one at:


Also visit the raster package on R-Forge, which may offer a packaged solution to

Roger Bivand

> I am running linux 64bit on opensuse11 and R 2.8.0
> Thanx
> Herry

More information about the R-help mailing list