Hello,

I want to replace specific values in a STFDF object from the spacetime package. 
As example consider the following stfdf object out of the vignette.

sp = cbind(x = c(0,0,1), y = c(0,1,1))
row.names(sp) = paste("point", 1:nrow(sp), sep="")
sp = SpatialPoints(sp)
time = xts(1:4, as.POSIXct("2010-08-05", tz = "GMT")+3600*(10:13))
m = c(10,20,30) # means for each of the 3 point locations
mydata = rnorm(length(sp)*length(time),mean=rep(m, 4))
IDs = paste("ID",1:length(mydata), sep = "_")
mydata = data.frame(values = signif(mydata,3), ID=IDs)
stfdf = STFDF(sp, time, mydata)

Now I want to do something like this:

stfdf[ , 1]@data$values <- stfdf[ , 1]@data$values + 1

I get the following error:

Error in stfdf[, 1]@data$values <- stfdf[, 1]@data$values + 1 : 
  object of type 'S4' is not subsettable

Does anybody know how to do that in a correct way?
Thanks a lot,
Martin Roth
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to