假设我有'SpatialGridDataFrame'。
grd <- GridTopology(c(0,0), c(10,10), c(10,20))
grdx = SpatialGridDataFrame(grd, d=data.frame(www))
其中'www'是num [1:200] 1010 1010 1010 1009 1009 ...(200个隐含的1个变量)
我想更改g $ www并记住所有具有不同名称的实现 例如,如果我做
r <- replicate(15,rnorm(10*20,mean=0,sd=3)) # matrix 200x15 with random numbers
m <-(matrix(nrow=200,ncol=15))
for (i in 1:15){
m [,i] <- g[[1]] + r[,i]} # matrix 200x15 with INPUT values for g$www
最后我想:
'SpatialGridDataFrame'g_1与g $ www = m [,1];
'SpatialGridDataFrame'g_2与g $ www = m [,2];
'SpatialGridDataFrame'g_3,g $ www = m [,3];等
谢谢!