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

和自甴很熟 提交于 2020-03-05 07:04:51

问题


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.)))

回答1:


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


来源:https://stackoverflow.com/questions/56091313/overlay-is-not-an-exported-object-from-namespacesp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!