Re: [R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-14 Thread Edzer Pebesma
On 08/13/2010 03:33 PM, Patrick Giraudoux wrote: > Thank you both, that is very clear now. SpatialPixelsDataFrame objects > can be "indexed" as a data frame, but not SpatialGridDataFrame where > row, col, band must be specified (thanks also not to have written, > please read the doc, which was a

Re: [R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-13 Thread Patrick Giraudoux
Thank you both, that is very clear now. SpatialPixelsDataFrame objects can be "indexed" as a data frame, but not SpatialGridDataFrame where row, col, band must be specified (thanks also not to have written, please read the doc, which was all what I deserved..) Actually, my question was simpli

Re: [R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-13 Thread Nikhil Kaza
you mean > chinatemput...@data[idx,] ? If you want to subset the grid itself, look at the examples for SpatialGridDataFrame class # the following is weird, but illustrates the concept of row/col selection: data(meuse.grid) # only the non-missing valued cells fullgrid(meuse.grid) = TRUE imag

Re: [R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-13 Thread Roger Bivand
On Fri, 13 Aug 2010, Patrick Giraudoux wrote: Hi, I am trying to subset a SpatialGridDataFrame object as following: idx<-chinatemput...@data[,1]>10 # select elements of column1 whose values are > 10 idx[is.na(idx)]<-FALSE # make a vector of class "logical" (replacing NA by FALSE) and thi

[R-sig-Geo] subsetting a SpatialGridDataFrame image.SpatialGridDataFrame

2010-08-13 Thread Patrick Giraudoux
Hi, I am trying to subset a SpatialGridDataFrame object as following: idx<-chinatemput...@data[,1]>10 # select elements of column1 whose values are > 10 idx[is.na(idx)]<-FALSE # make a vector of class "logical" (replacing NA by FALSE) and this gives: ChinaTempUTM47[idx,] Error in ChinaTem