Skip to content

Commit 33f198b

Browse files
committed
better error message to trap defective listw objects from adespatial::chooseCN()
1 parent 4ae9f5e commit 33f198b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

R/jacobian_setup.R

+2
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ jacobianSetup <- function(method, env, con, pre_eig=NULL, trs=NULL, interval=NUL
175175

176176
can.be.simmed <- function(listw) {
177177
res <- is.symmetric.nb(listw$neighbours, FALSE)
178+
if (is.null(attr(listw$weights, "comp")))
179+
stop("non-compliant listw object, re-build using spdep::nb2listw()")
178180
if (res) {
179181
if (attr(listw$weights, "mode") == "general")
180182
res <- attr(listw$weights, "glistsym")

0 commit comments

Comments
 (0)