Dear all, I have a SpatialGridDataFrame which I read from grass myrast<-readRAST6("DRENVAL")
Now I attrib a sequential number for each pixel with: myrast @ data[[1]]<-1:dim(myrast @ data)[1] Now I need to select record by record, from 1 to N, get the bbox() from each record, set the g.region and compute somethings for the region of each pixel. But my problem relies on subset each of object. I tryed something like: for (i in 1:dim(myrast @ data)[1]) { myrast.pixel<-subset(myrast, myrast @ data$DRENVAL==i) OR myrast.pixel<-myrast[myrast @ data$DRENVAL==i,] ...my processing } But I don't know how subset the SGDF. Sorry for not provide a reproducible example. Bests, 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.6-5 XML_2.3-0 rgdal_0.6-7 maptools_0.7-20 sp_0.9-32 [6] foreign_0.8-34 gpclib_1.4-3 adehabitat_1.8.2 ade4_1.4-10 loaded via a namespace (and not attached): [1] grid_2.9.0 lattice_0.17-20 [[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