
425Geostatistics
12.6.4 functions
The following function Okriging.R performs ordinary kriging the function is
Okriging <- function (dataset, vario, step, maxdist,border.
sw=F,border.poly="none"){
# dataset: columns 1 and 2 are x,y coordinates, 3 is variable
# vario is variogram model, step is interval for the prediction grid
# maxdist is max distance for prediction
# extract names of coord and variable
x <- names(dataset)[1]
y <- names(dataset)[2]
v <- names(dataset)[3]
# First, select a grid for the prediction.
# Use min and max of the original dataset and a distance step
grid <- list(x=seq(min(dataset[,1]),max(dataset[,1]),by=step),
y=seq(min(dataset[,2]),max(dataset[,2]),by=step)) ...