[R-sig-Geo] problem with example inverse distance weighted (IDW) interpolation

melita melita at cirus.dhz.hr
Thu Sep 13 12:43:03 CEST 2012


Dear Roger

I tried to reproduce this example, and also ended with an error:
#################################################
# Error: is.ppp(X) && is.marked(X) is not TRUE
#################################################

While krige is working fine:
> idw.out <- krige(zinc ~ 1, meuse, meuse.grid)
[inverse distance weighted interpolation]


Usually I use krige function for the idw with squared distances, but
recently I wanted to test linear distances in idw, without success. Now I
saw this post of Nerak so maybe you can help us to solve it.


Regards,

Melita Percec Tadic
Meteorological and Hydrological Service of Croatia.

Example together with the info session:

sessionInfo() 
#R version 2.15.0 (2012-03-30)
#Platform: i386-pc-mingw32/i386 (32-bit)

#locale:
#[1] LC_COLLATE=Croatian_Croatia.1250  LC_CTYPE=Croatian_Croatia.1250   
LC_MONETARY=Croatian_Croatia.1250 LC_NUMERIC=C                     
#[5] LC_TIME=Croatian_Croatia.1250    

#attached base packages:
#[1] stats     graphics  grDevices utils     datasets  methods   base     

#other attached packages:
# [1] spatstat_1.26-1    deldir_0.0-19      mgcv_1.7-16        boot_1.3-4        
RColorBrewer_1.0-5 classInt_0.1-18    e1071_1.6         
# [8] class_7.3-3        gstat_1.0-10       spacetime_0.6-2    xts_0.8-6         
zoo_1.7-7          rgdal_0.7-11       maptools_0.8-14   
#[15] lattice_0.20-6     sp_0.9-99          foreign_0.8-49    

#loaded via a namespace (and not attached):
#[1] grid_2.15.0  Matrix_1.0-6 nlme_3.1-103 tools_2.15.0


library(gstat)
data(meuse)
coordinates(meuse) <- c("x", "y")
data(meuse.grid)
coordinates(meuse.grid) <- c("x", "y")
gridded(meuse.grid) <- TRUE
idw.out <- idw(zinc ~ 1, meuse, meuse.grid, idp = 2.0)

#################################################
# Error: is.ppp(X) && is.marked(X) is not TRUE
#################################################

spplot(idw.out, "var1.pred")



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/problem-with-example-inverse-distance-weighted-IDW-interpolation-tp7580941p7580951.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list