diff --git a/NEWS.md b/NEWS.md index c0e02dfd..1c70e2bb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,8 @@ * replace `rgrass7` with `rgrass` in vignette +* fix #133 (`edit.nb` affected by not attaching `sp`) + # Version 1.2-8 (2023-02-28) * `mat2listw()` warning if no `style=` argument given, or if `M"` is given https://github.com/r-spatial/spatialreg/issues/24, https://github.com/r-spatial/spatialreg/issues/23. diff --git a/R/edit.nb.R b/R/edit.nb.R index 0be7df05..5a4def48 100644 --- a/R/edit.nb.R +++ b/R/edit.nb.R @@ -27,7 +27,7 @@ edit.nb <- function(name, coords, polys=NULL, ..., use_region.id=FALSE) { plot.window(xlim = xlim, ylim = ylim, "", asp=1) if (!is.null(polys)) if (inherits(polys, "SpatialPolygons")) - plot(polys, border="grey", add=TRUE) + sp::plot(polys, border="grey", add=TRUE) else stop("polys of unknown class") # bug report Conceicao Ribeiro 100731 for (i in 1:n) { @@ -135,7 +135,7 @@ edit.nb <- function(name, coords, polys=NULL, ..., use_region.id=FALSE) { plot.new() plot.window(xlim = xlim, ylim = ylim, "", asp=1) if (!is.null(polys)) - plot(polys, border="grey", add=TRUE) + sp::plot(polys, border="grey", add=TRUE) for (i in 1:n) { if(nb[[i]][1]!=0 & length(nb[[i]])>0L) segments(x[i],y[i],x[nb[[i]]],y[nb[[i]]])