Below is an R function for calling the C routines. To use, specify the following arguments matIn-matrix in which first 2 columns hold the locations of observed data and 3rd column holds the meaured value at that location nBin-number of bins to use in the estimate delDim-size of grid to use in searching for best delta delLo-smallest value used for the grid search for delta, usually zero delHi-largest value used for the grid earch for delta maxDis-largest lag distance at which the variogram is estimated > nwVrgram function(matIn,nBin,delDim,delLo,delHi,maxDis){ dyn.load("nwVgram.so") vrgrm <- c(1:nBin) nwVrgrm <- c(1:nBin) out<-.C("nwVrgram",nn=as.integer(dim(matIn)[1]),noBins= as.integer(nBin),dDim=as.integer(delDim),deltaLo= as.double(delLo),deltaHi=as.double(delHi),loc1In= as.double(matIn[,1]),loc2In=as.double(matIn[,2]), yIn=as.double(matIn[,3]),vgram=as.double(vrgrm), nwVgram=as.double(nwVrgrm),mxDis=as.double(maxDis)) return(cbind(out$vgram,out$nwVgram)) } once this is set up in your R session, in UNIX run % R CMD SHLIB nwVgram.c then a typical call would look like > v1 <- nwVrgram(radonMeas,20,10,0,150,5000)