Dear all, I have two SpatialGridDataFrame objects with different extent:
------------ > str(reser) Formal class 'SpatialGridDataFrame' [package "sp"] with 6 slots ..@ data :'data.frame': 1826316 obs. of 1 variable: .. ..$ band1: int [1:1826316] 0 0 0 0 0 0 0 0 0 0 ... ..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots .. .. ..@ cellcentre.offset: Named num [1:2] 371065 8764123 .. .. .. ..- attr(*, "names")= chr [1:2] "x" "y" .. .. ..@ cellsize : num [1:2] 60 59.9 .. .. ..@ cells.dim : int [1:2] 1569 1164 ..@ grid.index : int(0) ..@ coords : num [1:2, 1:2] 371065 465109 8764123 8833815 .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : NULL .. .. ..$ : chr [1:2] "x" "y" ..@ bbox : num [1:2, 1:2] 371035 8764093 465139 8833845 .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:2] "x" "y" .. .. ..$ : chr [1:2] "min" "max" ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots .. .. ..@ projargs: chr " +proj=utm +zone=21 +south +ellps=aust_SA +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" > ----------- > str(tst) Formal class 'SpatialGridDataFrame' [package "sp"] with 6 slots ..@ data :'data.frame': 1823584 obs. of 1 variable: .. ..$ vegetacao: int [1:1823584] 1 1 1 1 1 1 1 1 1 1 ... ..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots .. .. ..@ cellcentre.offset: Named num [1:2] 371065 8764123 .. .. .. ..- attr(*, "names")= chr [1:2] "x" "y" .. .. ..@ cellsize : num [1:2] 60 60 .. .. ..@ cells.dim : int [1:2] 1568 1163 ..@ grid.index : int(0) ..@ coords : num [1:2, 1:2] 371065 465109 8764123 8833815 .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : NULL .. .. ..$ : chr [1:2] "x" "y" ..@ bbox : num [1:2, 1:2] 371035 8764093 465139 8833845 .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:2] "x" "y" .. .. ..$ : chr [1:2] "min" "max" ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots .. .. ..@ projargs: chr " +proj=utm +south +no_defs +zone=21 +a=6378160 +rf=298.25 +to_meter=1" > ------------------ Notice the dimensions are: reser .. .. ..@ cells.dim : int [1:2] 1569 1164 tst .. .. ..@ cells.dim : int [1:2] 1568 1163 Now I need that the object reser receive the pixel values from tst when reser==1. I tryed to overlap and force gridded() like reser_tst<-overlap(reser,tst) gridded(reser_tst)=T tst_reser<-overlap(tst,reser) gridded(tst_reser)=T But I don't know how can I have an object with the dimensions of reser, but withe the values of tst only when reser==1. Sorry for not send a reproducible code. Best wishes, milton --- > sessionInfo() R version 2.9.0 alpha (2009-03-26 r48224) i386-pc-mingw32 locale: LC_COLLATE=English_Canada.1252;LC_CTYPE=English_Canada.1252;LC_MONETARY=English_Canada.1252;LC_NUMERIC=C;LC_TIME=English_Canada.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] spgrass6_0.5-18 raster_0.8.9-6 maptools_0.7-20 foreign_0.8-34 rgdal_0.6-7 sp_0.9-32 loaded via a namespace (and not attached): [1] grid_2.9.0 lattice_0.17-20 tools_2.9.0 [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo