I'm trying to use this code, adapted from dataset meuse
data<-list(var1,var2,x,y)
coordinates(data)=~x+y
grid = spsample(data, type = "regular", cellsize = c(0.05,0.05))
vt <- variogram(var1 ~ var2,data=data)
vt.fit <- fit.variogram(vt, vgm(0.2, "Sph", 800, 0.05))
gstatobj <- gstat(id = 'var1', formula = var1 ~ var2, model=vt.fit, set = list(gls=1))
My goal is creating a grid, like meuse.grid
. But coordinates
doesn't work... list isn't the right command.
What shall I use? Is correct the way I'm using to create the grid?
the following reproducible example shows jlhoward's comment is right, and Darko's reply is wrong:
you may have been confused by doing this again, which would give:
but leaves the existing (and correct)
data
in tact.