Skip to content
Prev 11152 / 29559 Next

replace values in spacetime (STFDF) object

What Martin wants, replacing a subset, is not possible for STFDF (or
other ST*) objects, just as with Spatial* objects:

library(sp)
data(meuse)
coordinates(meuse)=~x+y
meuse[1, "zinc"] = 500
Error in meuse[1, "zinc"] = 500 : object of type 'S4' is not subsettable

Indeed, as Aman suggests, this could be done by subsetting the
data.frame slot, and

meuse$zinc[1] = 500

is a nice/short form for

meuse at data$zinc[1] = 500.

the second form,

meuse$zinc[1] = 500

really calls function "[<-.data.frame"

whereas

meuse[1,"zinc"]<-500 tries to call "[<-.SpatialPointsDataFrame", which
is not available.

The same is true for "[<-.STFDF".

It would be helpful to get some more information why you would need to
do such replacement. For the Spatial* classes this request is very rare,
but in space-time everything might be different, and we'd like to hear
the how/why.

Best regards,
On 03/11/2011 09:54 PM, Aman Verma wrote: