On Tue, 22 Jan 2008, Jarek Jasiewicz wrote:

Hi?

subset(spGRID, raster==1) or subset(spGRID, data$raster==1)
Can I do this or something similar??

i.e I'd like to avoid to convert raster to regular data.frame and use subset on dataf.rame due to long time of conversion

Hi,

There is no guarantee that the output is going to be a full grid, so I suggest casting to SpatialPixelsDataFrame first and subsetting that:

library(sp)
data(meuse.grid)
coordinates(meuse.grid) <- c("x", "y")
gridded(meuse.grid) = TRUE
fullgrid(meuse.grid) = TRUE
summary(meuse.grid)
o1 <- as(meuse.grid, "SpatialPixelsDataFrame")
o2 <- o1[o1$ffreq == 1,]
summary(o2)

Hope this helps,

Roger

tahnx
Jarek
_______________________________________________
grass-stats mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-stats


--
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: [EMAIL PROTECTED]

_______________________________________________
grass-stats mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-stats

Reply via email to