
you mean
> ChinaTempUTM47@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
image(meuse.grid)
image(meuse.grid[20:70, 10:70, "dist"], add = TRUE, col = bpy.colors())

Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina

nikhil.list@gmail.com

On Aug 13, 2010, at 8:10 AM, Patrick Giraudoux wrote:

> Hi,
>
> I am trying to subset a SpatialGridDataFrame object as following:
>
> idx<-ChinaTempUTM47@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 ChinaTempUTM47[idx, ] : (subscript) logical subscript too  
> long
>
> However,
>
> > length(idx)
> [1] 13536
> > nrow(ChinaTempUTM47@data)
> [1] 13536
>
>
> So, I canot sort out what happens.
>
> Any hint welcome
>
> Patrick
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


	[[alternative HTML version deleted]]

