'overlay' is not an exported object from 'namespace:sp' [duplicate]
Asked Answered
P

1

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.)))
Present answered 11/5, 2019 at 14:38 Comment(2)
I don't think you know all of the packages that are loaded. krige.control is not in pkg:splancs either.Mimi
Can you please make a reproducible example, only showing code relevant to the question, and show where the error happens?Hustler
M
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
Mimi answered 11/5, 2019 at 14:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.