Commits

Paul Hiemstra  committed fc87c1a

Changes needed to pass the latest CRAN checks. Thanks to Jon Skoien.

  • Participants
  • Parent commits d0e7a5c

Comments (0)

Files changed (6)

 Package: automap
-Version: 1.0-13
-Date: 2012/08/30
+Version: 1.0-14
+Date: 2013/08/27
 Title: Automatic interpolation package
 Author: Paul Hiemstra <paul@numbertheory.nl>
 Maintainer: Paul Hiemstra <paul@numbertheory.nl>
 Description: This package performs an automatic interpolation by automatically estimating the variogram and then calling gstat.
-Depends: R (>= 2.10.0), methods, sp (>= 0.9-55), gstat (>= 0.9-65)
-Imports: lattice
-Suggests: ggplot2,maptools,gpclib
+Depends: R (>= 2.10.0), sp (>= 0.9-55)
+Imports: gstat, lattice, reshape
+Suggests: ggplot2, maptools, gpclib
 License: GPL
+Packaged: 2013-08-28 08:23:20 UTC; skoiejo
-import(methods)
 import(lattice)
 import(sp)
 import(gstat)
+import(reshape)
 
 export(autoKrige,
 	autofitVariogram,

File R/autokrige.vgm.panel.r

 autokrige.vgm.panel = function(x, y, model, subscripts,...)
 {
     # Call original gstat panel
-    gstat:::vgm.panel.xyplot(x, y, model = model, subscript = TRUE,...)
+    vgm.panel.xyplot(x, y, model = model, subscripts = TRUE,...)
 
     # Add the text.
     no_digits = function(a)

File R/plot.autoKrige.r

 # This includes the kriging prediction, the kriging results,
 # the experimental variogram and the fitted variogram model
 {
-    shift = 0.03
-    labels = as.character(x$exp_var$np)
-    vario = xyplot(gamma ~ dist, data = x$exp_var, panel = autokrige.vgm.panel,
-                labels = labels, shift = shift, model = x$var_model,# subscripts = TRUE,
-                direction = c(x$exp_var$dir.hor[1], x$exp_var$dir.ver[1]),
-                ylim = c(min(0, 1.04 * min(x$exp_var$gamma)), 1.04 * max(x$exp_var$gamma)),
-                xlim = c(0, 1.04 * max(x$exp_var$dist)), xlab = "Distance", ylab = "Semi-variance",
-                main = "Experimental variogram and fitted variogram model", mode = "direct",...)
+    
+    xx = list(exp_var = x$exp_var, var_model = x$var_model)
+    class(xx) = "autofitVariogram"
+    vario = plot(xx, plotit = FALSE)
                 
 #                		xyplot(gamma ~ dist, data = x, panel = panel, xlim = xlim, 
 #			ylim = ylim, xlab = xlab, ylab = ylab, labels = labels, model = model, 
           main = "Kriging standard error",
           sp.layout = sp.layout, ...)
 
-    print(pred, position = c(0,.5,.5,1),more=T)
-    print(stdev, position = c(.5,.5,1,1),more = T)
-    print(vario, position = c(0,0,1,.5)) 
-
+      print(pred, position = c(0,.5,.5,1),more=T)
+      print(stdev, position = c(.5,.5,1,1),more = T)
+      print(vario, position = c(0,0,1,.5)) 
 }
 
 

File R/plot.autofitVariogram.r

-plot.autofitVariogram = function(x,...)
-{
-    plot(x$exp_var,x$var_model,...)
+plot.autofitVariogram = function(x, plotit = TRUE, ...)
+{ 
+    shift = 0.03
+    labels = as.character(x$exp_var$np)
+    vario = xyplot(gamma ~ dist, data = x$exp_var, panel = autokrige.vgm.panel,
+                labels = labels, shift = shift, model = x$var_model,# subscripts = TRUE,
+                direction = c(x$exp_var$dir.hor[1], x$exp_var$dir.ver[1]),
+                ylim = c(min(0, 1.04 * min(x$exp_var$gamma)), 1.04 * max(x$exp_var$gamma)),
+                xlim = c(0, 1.04 * max(x$exp_var$dist)), xlab = "Distance", ylab = "Semi-variance",
+                main = "Experimental variogram and fitted variogram model", mode = "direct",...)
+   if (plotit) print(vario) else vario
 }

File man/autoKrige.rd

 \seealso{\code{\link{autofitVariogram}}, \code{\link[gstat]{krige}}}
 \examples{
 # Data preparation
+\dontrun{
 data(meuse)
 coordinates(meuse) =~ x+y
 data(meuse.grid)
 kriging_result = autoKrige(zinc~soil+ffreq+dist, meuse, meuse.grid)
 plot(kriging_result)
 
-# Block kriging
+# Block kriging  
 kriging_result_block = autoKrige(zinc~soil+ffreq+dist, 
 	meuse, meuse.grid, block = c(400,400))
 plot(kriging_result_block)
 sample_variogram = kr$exp_var
 variogram_model = kr$var_model
 }
+}