0

I have some code showing this error, but, I haven't called "overlay", maybe it's a library function that is calling it

Code:

d.mle=likfit(P, ini.cov.pars = c(1,30), cov.model = 'matern', kappa = 0.5) 
d.mle

Xb = c(1, size, size, 1)
Yb = c(1, 1, size, size)
bordas = cbind(Xb, Yb)
polygon(bordas)
Ap = matrix(apply(bordas, 2, range))
gr <- expand.grid(x = seq(Ap[1, ], Ap[2, ], by = 1), y = seq(Ap[3, ], Ap[4, ], by = 1))
require(splancs)
gi <- polygrid(gr, borders = bordas) # delimita a area para interpolação
points(gi, pch = "+", col = 2)
KC  = krige.control(obj = d.mle, type.krige = "ok", lam = 1) 
d.k = krige.conv(P, loc = gr, krige = KC) #Realiza a interpolação por krigagem

valores_preditos = d.k$predict
Ze = matrix(valores_preditos, size, size) # Transforma os valores preditos em matriz
plot(Ze)
plot(image(X, Y, Ze, col = gray((0 : 4) / 4), breaks = c(a., b., c., d., e., f.)))
zx8754
  • 52,746
  • 12
  • 114
  • 209
Guilherme Poleto
  • 327
  • 1
  • 2
  • 13
  • I don't think you know all of the packages that are loaded. `krige.control` is not in pkg:splancs either. – IRTFM May 11 '19 at 15:01
  • Can you please make a reproducible example, only showing code relevant to the question, and show where the error happens? – Robert Hijmans May 11 '19 at 15:17

1 Answers1

2

If you do this:

??overlay

... you should get a list of all the functions in packages that mention the word "overlay". When I do it, I see two functions with that name but I strongly suspect that it is the raster-package's version that is expected by the code you are using. So do this:

install.packages('raster')
library(raster)
#re-run code
IRTFM
  • 258,963
  • 21
  • 364
  • 487