Thanks Alexandre. Sorry my coding was a bit confusing but I have rectified
it now. When I run it however, I get error message. The new code and the
error message I get are as follows:

library(gstat)
library(raster)
x <- 1:10
#y <- 1:10
z<- 1:10
setwd("f:/Grids")
r2 <- raster("idgd_wgs.asc")

z.list <- list(z1<-runif(10), z2 <- runif(10), z3 <- runif(10))
da1<-data.frame(x=1:10, y=1:10)
for i in 1:length(z.list) {
 da.temp<-data.frame(da1, z=z.list[[i]])
 IDW.temp <- gstat(id = "z", formula = z~1, locations = ~x+y, data=da.temp,
set=list(idp =2))
 IDWRaster.temp <- interpolate(r2, IDW.temp)
 #add here one or two command lines to save the objects you want to save,
or check
 rm(da.temp, IDW.temp, IDWRaster.temp) #remove the temporary elements
(always safer)
}


### the error message I got is as follows

> library(gstat)
> library(raster)
>
> x <- 1:10
> #y <- 1:10
> z<- 1:10
> setwd("f:/Grids")
> r2 <- raster("idgd_wgs.asc")
>
>
> z.list <- list(z1<-runif(10), z2 <- runif(10), z3 <- runif(10))
> da1<-data.frame(x=1:10, y=1:10)
>
> for i in 1:length(z.list) {
Error: unexpected symbol in "for i"
>  da.temp<-data.frame(da1, z=z.list[[i]])
Error in data.frame(da1, z = z.list[[i]]) : object 'i' not found
>  IDW.temp <- gstat(id = "z", formula = z~1, locations = ~x+y,
data=da.temp, set=list(idp =2))
Error in gstat(id = "z", formula = z ~ 1, locations = ~x + y, data =
da.temp,  :
  object 'da.temp' not found
>  IDWRaster.temp <- interpolate(r2, IDW.temp)
Error in inherits(model, "gstat") : object 'IDW.temp' not found
In addition: Warning messages:
1: In inherits(model, "gstat") : restarting interrupted promise evaluation
2: In inherits(model, "gstat") : restarting interrupted promise evaluation
>  #add here one or two command lines to save the objects you want to save,
or check
>  rm(da.temp, IDW.temp, IDWRaster.temp) #remove the temporary elements
(always safer)
Warning messages:
1: In rm(da.temp, IDW.temp, IDWRaster.temp) : object 'da.temp' not found
2: In rm(da.temp, IDW.temp, IDWRaster.temp) : object 'IDW.temp' not found
3: In rm(da.temp, IDW.temp, IDWRaster.temp) :
  object 'IDWRaster.temp' not found
> }
Error: unexpected '}' in "}"
thanks
//minti

On Sun, Dec 2, 2012 at 7:58 AM, Alexandre Villers <
villers.alexandre@gmail.com> wrote:

> Hello,
>
> It's not really clear from your message whether y1, y2, y3 are the y part
> of x/y coordinates, and

	[[alternative HTML version deleted]]

