Skip to content

error in krig interpolation

3 messages · Edzer Pebesma, Roger Bivand, temiz

#
el1 is already a SpatialPointsDataFrame, so omit the locations argument.

You may try something as simple as

zz <- krige(log(z) ~ 1, el1, mask_SG, efitted) 

--
Edzer
temiz wrote:
#
On Thu, 5 Apr 2007, Edzer J. Pebesma wrote:

            
The real problem is that "ORDINARY KRIGING IN R WITH GRASS6 DATA" is on a 
wiki with no responsible owner or maintainer, and no automatic way of 
synchronising it with current code:

http://grass.gdf-hannover.de/wiki/GRASS_6_Tutorial#GRASS_and_R_kriging_interpolation

The original is not signed, with no attached data sets or location, so we
can't ask anyone to keep it working.  I've added:

(WARNING!! Most of the code quoted here is very out of date, and simply 
does not work for current R/sp/gstat/spgrass6. Untried suggestions 
have been edited in, but without a test location, there is no 
guarantee that they will work! Roger Bivand, 5 April 2007)

at the top of the section, and tried to indicate the worst inaccuracies.

Roger

  
    
#
when does this error occur ?

 > zz <- krige(formula = log(el1$z) ~ 1, locations = ~x+y , data = el1 
,newdata = mask_SG , model = efitted) Error in function (classes, fdef, 
mtable)  :
        unable to find an inherited method for function "coordinates<-", 
for signature "SpatialPointsDataFrame"


str(el1) gives:

Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
  ..@ data       :'data.frame': 24051 obs. of  4 variables:
  .. ..$ cat: num [1:24051] 1 2 3 4 5 6 7 8 9 10 ...
  .. ..$ x  : num [1:24051] 449114 449204 449262 449263 449276 ...
  .. ..$ y  : num [1:24051] 4590406 4590375 4590117 4590304 4590214 ...
  .. ..$ z  : num [1:24051] 110 110 110 110 110 110 110 110 110 110 ...
  ..@ coords.nrs : num(0)
  ..@ coords     : num [1:24051, 1:2] 449114 449204 449262 449263 449276 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
  ..@ bbox       : num [1:2, 1:2]  449083 4584531  456552 4591890
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
  .. .. ..$ : chr [1:2] "min" "max"
  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
  .. .. ..@ projargs: chr " +proj=utm +zone=36 +ellps=intl +units=m 
+no_defs"



regards

-- 
Ahmet Temiz