tests/nbgraph.R

library(ade4)
library(adegraphics)
library(sp)
library(lattice)

pdf("nbgraph.pdf")

if(require(spdep)) {
data(elec88, package = "ade4")
coords <- sp::coordinates(elec88$Spatial)

xyplot(coords[, 2] ~ coords[, 1],
  		 panel = function(...) {adeg.panel.nb(elec88$nb, coords)})

g1 <- s.label(coords, nb = elec88$nb, porigin.include = F, plabels.cex = 0.7, 
              ppoints.cex = 2, Sp = elec88$Spatial, pSp.col = "red", pSp.alpha = 0.5)
}

Try the adegraphics package in your browser

Any scripts or data that you put into this service are public.

adegraphics documentation built on Oct. 13, 2023, 5:11 p.m.