[R-sig-Geo] Subsetting a SpatialPixels object: different behaviour with different versions of R and sp

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Jul 22 13:25:06 CEST 2011


On 07/22/2011 01:14 PM, Elena Couce Molina wrote:
> 
> Is this a bug? This creates problems later in the code when we try to
> convert the object into SpatialGrid class and get different bounding
> boxes...

No, it was done on purpose. I shared it with the rspatial-devel list in
this message:

http://lists.r-forge.r-project.org/pipermail/rspatial-devel/2011-May/000001.html

but when it got released, indeed did not inform the r-sig-geo
subscribers -- which would have been a good idea.

You should get the old behaviour (for both old and new sp versions) by
adding drop=TRUE to the selection, as in

meuse.grid[1:10, drop=TRUE]

Please let me know if this resolves your problem.
-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list