[R-sig-Geo] converting old sp objects

Roger Bivand Roger.Bivand at nhh.no
Fri Oct 27 18:22:54 CEST 2006

On Fri, 27 Oct 2006, Duncan Golicher wrote:

> I have quite a number of SpatialGridDataFrame objects that were saved 
> internally under R 2.3.0 and sp0.8-16.  Can anyone suggest a quick and 
> easy way to convert them for use with R2.4.0 and sp0.9-2. (I do have 
> ways, but they are all a bit longwinded).

The issue was announced on this list on 28 September:


and has been on the Rgeo site since about the same time.

The major issue is that the way new-style classes (and objects belonging 
to those classes) are defined internally, so the internal (*.RData) 
representations are not compatible.

To transfer from the old internal form, use R < 2.4.0, and sp < 0.9 to for 
example export column by column to GRASS, and then read back in in R >= 
2.4.0 and sp >= 0.9. Alternatively for non-GRASS users, rgdal and the 
GTiff fotmat could be used (and should work with multiple bands). The 
writeAsciiGrid() function in maptools could also be used. There is no way 
of upgrading the serialised object from the *.RData form directly. 

We know that this is an unfortunate incompatibility, but the changes in 
the methods package are being made to improve class/object handling, 
making the software faster and more robust, so the difficulties are 
unavoidable. For critical projects already using R < 2.4.0, I suggest only 
upgrading when sensible.


> Thanks,
> Duncan

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the R-sig-Geo mailing list