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

Patrick Giraudoux patrick.giraudoux at univ-fcomte.fr
Fri Aug 13 14:10:48 CEST 2010


  Hi,

I am trying to subset a SpatialGridDataFrame object as following:

idx<-ChinaTempUTM47 at 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 at data)
[1] 13536


So, I canot sort out what happens.

Any hint welcome

Patrick



More information about the R-sig-Geo mailing list