The answer below solved my fist question, so I edit my question as follows:
I have a shapefile given with the attributes lat, lon, elevation and temperature.
So far I have a script that interpolates only the temperature data:
#read shapefile:
shape <- readOGR("C:/Users.../Testarea.gdb", "temperature_data")
#grid shapefile:
shape.grid <- spsample(shape, type = "regular", offset = (c1,1))
gridded(shape.grid) <- TRUE
#kriging:
test <- krige(Temperatur~1, shape, shape.grid)
spplot(test[[1]])
Now my problem is that I should also need to consider the elevation, since the temperature is often dependant on this parameter. How can I do this?
Best Answer
You didn't pass
shape.grid
tokrige
. Try:Your example does not work as is,
ssample
should have beenspsample
. For your second question, you will need a grid with elevation data.